-
1. Re: How to disable the system log?
jaikiran Sep 29, 2014 1:59 AM (in response to blueclowd)What does the rest of the log message look like? Whoever is logging it seems to be using System.out.print... statements.
-
2. Re: How to disable the system log?
blueclowd Sep 29, 2014 9:18 PM (in response to jaikiran)
Hi Jaikiran,The rest of the log message looks fine as it exactly aligns to the pattern I designed in the config file. I am using slf4j + logback for logging and the entire logback.xml is shown as bellow.
Note that the unexpected message "18:30:00,028 INFO [stdout] (QuartzScheduler_Worker-3)...." only shown in the console while the output log file is clear. What's your opinon?
========================================================================================================
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name = "LOG_HOME" value = "./logs" />
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoding>UTF-8</encoding>
<encoder>
<pattern>[XXX][%-5p] %F/%M:%L, %m%n</pattern>
</encoder>
</appender>
<appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${LOG_HOME}/XXX.log</File>
<Append>true</Append>
<encoder>
<pattern>[XXX] %-5p %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %F/%M:%L, %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/BTI.log.%d{yyyy-MM-dd}</fileNamePattern>
</rollingPolicy>
</appender>
<logger name="com.tsmc.pdm">
<level value="DEBUG" />
</logger>
<logger name="com.tsmc.bti">
<level value="DEBUG" />
</logger>
<logger name="org.dozer">
<level value="WARN" />
</logger>
<root level="INFO">
<appender-ref ref="stdout"/>
<appender-ref ref="logfile"/>
</root>
</configuration>=======================================================================================================
-
3. Re: How to disable the system log?
jamezp Sep 30, 2014 1:51 PM (in response to blueclowd)1 of 1 people found this helpfulThe logback ConsoleAppender writes to stdout or System.out. This print stream is wrapped so that it can be written to the log manager handlers which is why you see the message formatted like that.
Is there a reason you're using logback rather than relying on the servers log management capabilities?
--
James R. Perkins
-
4. Re: How to disable the system log?
blueclowd Sep 30, 2014 9:04 PM (in response to jamezp)Dear James, thanks for your reply. May I reconfirm your directions?
1. The system log such as "18:30:00,028 INFO [stdout] (QuartzScheduler_Worker-3)...." is definitely shown in console if I use ConsoleAppender?
2. If so, is there an alternative way to show the customized log without the system log ahead?
Actually, I just do the migration from slf4j+log4j to slf4j+logback by office demand. The servers log management capabilities seem not fulfill our requirement for producing customized log.
Is it true?
-
5. Re: How to disable the system log?
jamezp Oct 1, 2014 5:59 PM (in response to blueclowd)That's correct. Using the ConsoleAppender writes to System.out which is wrapped by the server. If you look at your log file they should be just the way you have formatted.
I'm not sure what your requirements are, but looking at the appenders used it looks like the server logging should accommodate it fine. The ConsoleAppender would be mapped to a console-handler and the RollingFileAppender would be mapped to a periodic-rotating-file-appender.
--
James R. Perkins
-
6. Re: How to disable the system log?
blueclowd Oct 1, 2014 9:03 PM (in response to jamezp)
Dear James, thanks for your further information. Do you know if there is an alternative way to show the customized log without the system log ahead? -
7. Re: How to disable the system log?
jamezp Oct 2, 2014 11:10 AM (in response to blueclowd)I assume you mean without the standard outputs wrapped by a logger. If my assumption is correct, then no. It's possible with some work you could use a different log manager for standalone. You'd have to remove the logging subsystem and most likely remove the org.jboss.logmanager module. Or maybe just remove the reference to it from the org.jboss.as.server module. This would not work in domain as domain requires org.jboss.logmanager.
The general rule is if you want to use a your own logmanager, then don't use a ConsoleAppender/Handler. They tend to be an issue.
One other thought is you might be able to create a logger named stdout and give it a format pattern of "%s%n". Stack traces might print a bit funny, but it should mostly work.
--
James R. Perkins