Hi We have an interesting problem with an EJB that is writing to our logger.
Normally applications write to the log in the following format: 2006-08-01 10:42:16,078 INFO [org.jboss.logging.Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml 2006-08-01 10:42:16,078 DEBUG [org.jboss.logging.Log4jService] Removed System.out adapter 2006-08-01 10:42:16,078 DEBUG [org.jboss.logging.Log4jService] Removed System.err adapter 2006-08-01 10:42:22,031 WARN [net.sf.ehcache.config.ConfigurationFactory] No configuration found. Configuring ehcac....... Yip, this is dependent on how your logger is configured, but the example is the standard way in which we write to the log file. I'm pretty familiar with log4j and normally use it through Apache commons logging in Tomcat. One of the guys here wrote an EJB that appends to the log. The problem is that the log output looks as follows: 2006-08-01 10:43:03,843 INFO [STDOUT] Aug 1, 2006 10:43:03 AM santam.ITCService getSantamScore INFO: This is our log message What's wierd here is that the class name (%c in log4j layout terms) is [STDOUT], and after [STDOUT] seems to follow our actual log message, almost as though our log message is wrapped in another message. We've trimmed our conf/log4j.xml config file somewhat in an attempt to isolate the problem, so what follows is our trimmed one: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender"> <param name="File" value="${jboss.server.home.dir}/log/server.log"/> <param name="Append" value="true"/> <param name="MaxFileSize" value="2048KB"/> <param name="MaxBackupIndex" value="2"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> </layout> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="DEBUG" /> <param name="LevelMax" value="FATAL" /> </filter> </appender> <root> <level value="DEBUG" /> <appender-ref ref="FILE"/> </root> </log4j:configuration> Here is the EJB that is writing to the log. Just note, that the developer originally used java.util.logging.Logger, but we have already tried switching this to Apache commons logging. This is the java.util.logging.Logger example: import java.util.logging.Level; import java.util.logging.Logger; public class ITCService implements SessionBean { private static final long serialVersionUID = -1022520306400664839L; Logger eventLogger = Logger.getLogger("santam.ITCEVENTLOG"); public Response getSantamScore(ConsumerEnquiry enquiry, String branchNumber, String clientRef) throws EJBException{ eventLogger.log(Level.INFO,"This is our log message"); return ... } } Given the above information I would have thought that the information being logged would be as follows: 2006-08-01 10:42:16,078 INFO [santam.ITCEVENTLOG] This is our log message Do any of you have a suggestion as to what the problem may be, and why the log output is not as expected? Regards Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CTJUG Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/CTJUG-Forum For the ctjug home page see http://www.ctjug.org.za -~----------~----~----~----~------~----~------~--~---
