NutzCN Logo
问答 使用logback,部分类名显示为org.nutz.log.impl.Log4jLogAdapter
发布于 483天前 作者 duTaojin 359 次浏览 复制 上一个帖子 下一个帖子
标签:

之前使用log4j正常的,但nutz-integration-quartz之类的插件使用的是logback,为了配置输出日志级别,使用logback。
但使用logback后,目前需要将所有地方的Logs.get() 替换为 LoggerFactory.getLogger(getClass()),但nutz框架中的就改不了了。
如何配置可以让Logs.get() 输入的日志显示正确的类名?或者其它好的方法?

maven配置为:

<dependency>
			<groupId>org.nutz</groupId>
			<artifactId>nutz</artifactId>
			<version>1.r.62</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>log4j-over-slf4j</artifactId>
			<version>1.7.29</version>
		</dependency>
12/14 13:06:15.425 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - NutFilter[nutz] starting ...
12/14 13:06:15.851 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Nutz Version : 1.r.62 
12/14 13:06:15.852 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Nutz.Mvc[nutz] is initializing ...
12/14 13:06:16.630 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Found 39 classes in 6 base-packages!
beans = ["robotInterface", "dataObserver", "robotTaskExecJob", "robotPatrolAll", "stationJob", "robotConstants", "pathService", "historySave", "devDataObservable", "fCardDynamicPW", "configConstants", "perHourSchedule", "stationService", "dictionaryConstants", "voiceWebsocket", "fCardRecord", "myWebsocket", "robotTaskService", "imgDataObservable", "iec61850Server", "demoJob", "dongGuanService", "iec104Service", "robotPointNoticeJob", "fileService", "sqlService", "analysis", "quartzJobService", "staticConstants", "deviceCommand", "deviceConstants", "fCardSync", "doubleRoundService", "tableService", "iec61850Job", "communiReturn", "dataCheck", "receives", "robotTaskCreateJob"]
12/14 13:06:16.774 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - NutIoc init begin ...
12/14 13:06:16.783 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - ... NutIoc init complete
12/14 13:06:16.795 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
12/14 13:06:17.710 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.InterfaceControler
12/14 13:06:17.714 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Optional processor class not found, disabled : org.nutz.integration.shiro.NutShiroProcessor
12/14 13:06:17.762 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Optional processor class not found, disabled : org.nutz.plugins.validation.ValidationProcessor
12/14 13:06:17.840 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.simulatedControler
12/14 13:06:17.850 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.ProtocolControler
12/14 13:06:17.857 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.CommonControler
12/14 13:06:17.921 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Init file-pool by: D:/dutaojin/workspace4/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/nutz.station/WEB-INF/tmp [2000]
12/14 13:06:17.930 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - file-pool.cursor: 0
12/14 13:06:17.950 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.ConfigControler
12/14 13:06:18.081 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.RecordControler
12/14 13:06:18.137 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.IndexControler
12/14 13:06:18.161 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.MainMoudle
12/14 13:06:18.167 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.CurrentControler
12/14 13:06:18.182 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.RobotControler
12/14 13:06:18.227 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.TestControler
12/14 13:06:18.242 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.JsonControler
12/14 13:06:18.334 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.DemoControler
12/14 13:06:18.408 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.TableControler
12/14 13:06:18.439 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.HkwsControler
12/14 13:06:18.451 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Create Module obj without Ioc --> class com.easysoft.controller.RobotRound
12/14 13:06:18.513 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Found 170 module methods
12/14 13:06:18.518 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Setup application...
12/14 13:06:19.418 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - LibraryPath:D:\environment\jdk1.8.0_73\jre\bin
12/14 13:06:20.771 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
12/14 13:06:23.270 INFO  logback [localhost-startStop-1]  at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1208) - Using default implementation for ThreadExecutor
12/14 13:06:23.360 INFO  logback [localhost-startStop-1]  at org.quartz.core.SchedulerSignalerImpl.<init>(SchedulerSignalerImpl.java:61) - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
12/14 13:06:23.361 INFO  logback [localhost-startStop-1]  at org.quartz.core.QuartzScheduler.<init>(QuartzScheduler.java:229) - Quartz Scheduler v.2.3.0 created.
12/14 13:06:23.363 INFO  logback [localhost-startStop-1]  at org.quartz.simpl.RAMJobStore.initialize(RAMJobStore.java:155) - RAMJobStore initialized.
12/14 13:06:23.364 INFO  logback [localhost-startStop-1]  at org.quartz.core.QuartzScheduler.initialize(QuartzScheduler.java:294) - Scheduler meta-data: Quartz Scheduler (v2.3.0) 'NutzbookScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

12/14 13:06:23.365 INFO  logback [localhost-startStop-1]  at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1362) - Quartz scheduler 'NutzbookScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
12/14 13:06:23.365 INFO  logback [localhost-startStop-1]  at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1366) - Quartz scheduler version: 2.3.0
12/14 13:06:23.675 INFO  logback [localhost-startStop-1]  at org.quartz.core.QuartzScheduler.setJobFactory(QuartzScheduler.java:2287) - JobFactory set to: org.nutz.integration.quartz.NutQuartzJobFactory@b2da6f
12/14 13:06:23.677 INFO  logback [localhost-startStop-1]  at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:547) - Scheduler NutzbookScheduler_$_NON_CLUSTERED started.
12/14 13:06:28.503 INFO  logback [localhost-startStop-1]  at org.nutz.log.impl.Log4jLogAdapter$Log4JLogger.log(Log4jLogAdapter.java:110) - Nutz.Mvc[nutz] is up in 12649ms
2 回复

能不能换最新版?

@wendal 谢谢,替换为最新的包就没问题了。

添加回复
请先登陆
回到顶部