-
1. Re: How to logging from .esb service
tfennelly Oct 30, 2008 5:43 AM (in response to denix)AFAIK, this is not possible with the App Server. You can only log to the central (global) log. And yes, it sucks :-)
-
2. Re: How to logging from .esb service
tfennelly Oct 30, 2008 5:45 AM (in response to denix)Sorry... to add there..... what you could of course do is configure different log appenders and then log the different categories to the different appenders. It's still a bit crap, but at least you could use it to generate a log "per services".
-
3. Re: How to logging from .esb service
kconner Nov 3, 2008 7:36 AM (in response to denix)An alternative is to define your logging based on the context classloader.
See http://www.jboss.org/community/docs/DOC-12203 for the generic server details. -
4. Re: How to logging from .esb service
denix Nov 7, 2008 2:57 AM (in response to denix)One of my colleguages found the next solution with spring:
define bean<bean id="log4jInitialization" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetClass" value="org.springframework.util.Log4jConfigurer" /> <property name="targetMethod" value="initLogging" /> <property name="arguments"> <list> <value>classpath:log4j.xml</value> </list> </property> </bean>
define log4j.xml<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <!-- ============================== --> <!-- Append messages to the console --> <!-- ============================== --> <!-- ================================= --> <!-- Preserve messages in a local file --> <!-- ================================= --> <!-- A size based file rolling appender --> <appender name="SERVICE_FILE" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="${jboss.server.log.dir}/swifting.log" /> <param name="Append" value="true" /> <param name="MaxFileSize" value="500KB" /> <param name="MaxBackupIndex" value="1" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%t][%c] %m%n" /> </layout> </appender> <!-- ================ --> <!-- Setup logger --> <!-- ================ --> <logger name="com.ourproj"> <level value="debug" /> <appender-ref ref="SERVICE_FILE" /> </logger> <logger name="org.springframework"> <level value="warn" /> <appender-ref ref="SERVICE_FILE" /> </logger> <logger name="net.sf.ehcache"> <level value="warn" /> <appender-ref ref="SERVICE_FILE" /> </logger> <logger name="org.hibernate"> <level value="warn" /> <appender-ref ref="SERVICE_FILE" /> </logger> <logger name="org.apache"> <level value="warn" /> <appender-ref ref="SERVICE_FILE" /> </logger> <!-- ======================= --> <!-- Setup the Root Logger --> <!-- ======================= --> </log4j:configuration>
public class OurActionProcessor extends AbstractSpringAction { private static final Logger logger = Logger .getLogger(SwiftingActionProcessor.class); public void method() { logger.info("log something"); } }
It works -
5. Re: How to logging from .esb service
godwin.king Jul 6, 2010 2:09 AM (in response to denix)Keep eye on the topic, I'm also trying to find a solution for separate logging in different ESB package, I'm currently integrating some existing project to JBossESB case, just use classloader to load their class and lunch their method, but the log system seems give quite some trouble.
-
6. Re: How to logging from .esb service
h.wolffenbuttel Jul 6, 2010 3:02 AM (in response to denix)Hi Denys,
How does it know not to use the main JBoss logger? Do i need a springaction for it to work? (where did you place your bean?)
Regards,
Hans