如何在PlayFramework 2 Logging中输出类名称? [英] How do I output the class name in PlayFramework 2 Logging?
本文介绍了如何在PlayFramework 2 Logging中输出类名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我设置了一个logging.xml文件,如下所示.此文件包括输出到控制台以及滚动文件,该文件每天获取一个新文件:
I setup a logging.xml file as shown below. This file includes output to the console as well as a rolling file which gets a new file for everyday:
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${application.home}/logs/application.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${application.home}/logs/application.%d{yyyy-MM-dd}.log</FileNamePattern>
</rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
</layout>
</appender>
<appender name="A1" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%p %d{ISO8601} %c - %m%n</pattern>
</encoder>
</appender>
<logger name="javax.faces" level="debug" />
<root level="info">
<appender-ref ref="A1" />
<appender-ref ref="FILE" />
</root>
</configuration>
我的问题是如何也输出类名?我尝试阅读Play文档,但找不到答案……在生产环境中,也很难看不到类名.感谢您的帮助!
My question with this is how do I output the class name as well? I tried reading the Play documentation and could not find the answer to that... It's very hard in a production environment to not see classnames as well. Thanks for the help!
推荐答案
根据 doc ,要获取类名,您应该在模式%class{0}
According to the doc, to get the class name, you should use in your pattern %class{0}
这篇关于如何在PlayFramework 2 Logging中输出类名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文