简体   繁体   English

如何为Scala项目实施Scala日志记录?

[英]How to implement scala logging for a scala project?

I am creating a command based application, and need to setup logging for the project. 我正在创建一个基于命令的应用程序,并且需要为该项目设置日志记录。 Previously, I have only used the logging provided by Play framework and the configurations were already set. 以前,我仅使用Play框架提供的日志记录,并且已经设置了配置。 But since I need to setup logging for this project, how do we do so? 但是由于我需要为此项目设置日志记录,我们该怎么做?

I decided to use Scala Logging 2.1.2 , but checking on the github page there isn't any tutorial explaining how to set it up. 我决定使用Scala Logging 2.1.2 ,但是在github页面上检查并没有任何教程介绍如何设置它。

So, can you provide me with links to tutorials or examples, which explains the process of setting up logging for a scala project. 因此,您能否为我提供指向教程或示例的链接,以解释为scala项目设置日志的过程。 Thank you, any help is appreciated. 谢谢您的帮助。

Just stick to the JVM "standard": http://www.slf4j.org/ 只需遵循JVM“标准”即可: http : //www.slf4j.org/

You can use whichever implementation you prefer, either logback or log4j. 您可以使用任何喜欢的实现方式,即logback或log4j。

By the way, this is what Play uses under the hood, so you should be able to re-use most of what you learnt on your previous project. 顺便说一句,这就是Play在后台使用的功能,因此您应该能够重用在上一个项目中学到的大部分知识。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM