<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
<br><br><div><hr id="stopSpelling">From: onlymed@hotmail.com<br>To: logback-user@qos.ch; ceki@qos.ch<br>Subject: RE: [logback-user] Problem with Logback.XML<br>Date: Wed, 6 Jul 2011 14:56:25 +0200<br><br>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="Generator" content="Microsoft SafeHTML">
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
<div dir="ltr">
<br>Yes here is my logback.xml <br><br><br><br><configuration><br><br> <property name="InitialContextFactoryName" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" /><br> <property name="TopicConnectionFactoryBindingName" value="ConnectionFactory" /><br> <br> <property file="src/main/resources/MyLogger.properties" /><br> <br><!--************************************************************************* --><br><!-- **************************** Appenders ******************************--><br><!--************************************************************************* --><br> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"><br> <encoder><br> <pattern>%date{dd/mm/yyyy HH:mm:ss.SSS} %-5level %X{userId} %X{fluxId} ${MyLogger.application.name} %X{actionPath} %X{code} %X{actionId} %message %n</pattern><br> </encoder><br> </appender><br><br> <appender name="JMSTrace" class="ch.qos.logback.classic.net.JMSTopicAppender"><br> <InitialContextFactoryName>${InitialContextFactoryName}</InitialContextFactoryName><br> <ProviderURL>${MyLogger.jms.brokerURL}</ProviderURL><br> <TopicConnectionFactoryBindingName>${TopicConnectionFactoryBindingName}</TopicConnectionFactoryBindingName><br> <TopicBindingName>dynamicTopics/${MyLogger.jms.topic}</TopicBindingName><br> <br> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <br> <evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator --><br> <expression><br> (Level.ERROR.isGreaterOrEqual(event.getLevel()))<br> </expression><br> </evaluator><br> <OnMismatch>DENY</OnMismatch><br> <OnMatch>NEUTRAL</OnMatch><br> </filter><br> </appender><br> <br> <br> <!--Daily rolling ERROR_FILE file appender --><br> <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"><br> <FileNamePattern>${MyLogger.log.directory}/${MyLogger.application.name}_error.%exp{%d{yyyy-MM-dd_HHmm}}.log</FileNamePattern><br> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><br> <FileNamePattern>${MyLogger.log.directory}/${MyLogger.application.name}_error.%d{${MyLogger.log.rotation}}.log.zip</FileNamePattern><br> </rollingPolicy><br> <br> <encoder><br> <pattern>%date{dd/mm/yyyy HH:mm:ss.SSS} %-5level %X{userId} %X{fluxId} ${MyLogger.application.name} %X{actionPath} %X{code} %X{actionId} %message %n%replace(%caller){'Caller..', ''}</pattern><br> </encoder><br> <br> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <br> <evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator --><br> <expression><br> (event.getLevel().isGreaterOrEqual(Level.WARN)) <br> </expression><br> </evaluator><br> <OnMismatch>DENY</OnMismatch><br> <OnMatch>NEUTRAL</OnMatch><br> </filter><br> </appender><br> <br> <!--Daily rolling AUDIT_FILE file appender --><br> <appender name="AUDIT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"><br> <FileNamePattern>${MyLogger.log.directory}/${MyLogger.application.name}_audit.%exp{%d{yyyy-MM-dd_HHmm}}.log</FileNamePattern><br> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><br> <FileNamePattern>${MyLogger.log.directory}/${MyLogger.application.name}_audit.%d{${MyLogger.log.rotation}}.log.zip</FileNamePattern><br> </rollingPolicy><br> <br> <encoder><br> <pattern>%date{dd/mm/yyyy HH:mm:ss.SSS} %X{msgId} %-5level %X{userId} %X{fluxId} ${MyLogger.application.name} %X{actionPath} %X{code} %X{actionId} %message %n</pattern><br> </encoder><br> <br> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <br> <evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator --><br> <expression><br> (Level.INFO.equals(event.getLevel())) <br> </expression><br> </evaluator><br> <OnMismatch>DENY</OnMismatch><br> <OnMatch>NEUTRAL</OnMatch><br> </filter><br> <br> </appender><br> <br> <!--Daily rolling file DIAGNOSTIC_FILE appender --><br> <appender name="DIAGNOSTIC_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"><br> <FileNamePattern>${MyLogger.log.directory}/${MyLogger.application.name}_diagnostic.log.%exp{%d{yyyy-MM-dd_HHmm}}.log</FileNamePattern><br> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><br> <FileNamePattern>${MyLogger.log.directory}/${MyLogger.application.name}_diagnostic.%d{${MyLogger.log.rotation}}.log.zip</FileNamePattern><br> </rollingPolicy><br> <br> <encoder><br> <pattern>%date{dd/mm/yyyy HH:mm:ss.SSS} %-5level %X{userId} %X{fluxId} ${MyLogger.application.name} %X{actionPath} %X{code} %X{actionId} %message %n</pattern><br> </encoder><br> <br> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <br> <evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator --><br> <expression><br> (Level.ERROR.isGreaterOrEqual(event.getLevel())) <br> </expression><br> </evaluator><br> <OnMismatch>DENY</OnMismatch><br> <OnMatch>NEUTRAL</OnMatch><br> </filter><br> </appender><br> <br><!--*********************************************************************** --><br><!-- **************************** Loggers ******************************--><br><!--*********************************************************************** --><br> <logger name="entr.logger.trace"><br> <level value="trace" /><br> <appender-ref ref="JMSTrace" /><br> </logger><br> <br> <logger name="entr.logger.application"><br> <level value="trace" /><br> <appender-ref ref="STDOUT" /><br> <appender-ref ref="AUDIT_FILE" /><br> <appender-ref ref="ERROR_FILE" /><br> <appender-ref ref="DIAGNOSTIC_FILE" /><br> </logger><br> <br> <br> </configuration><br><br><br> //this one is used to print application logs (all the standard logback functions : info, debug...)<br> applicationLogger = (Logger) LoggerFactory.getLogger("entr.logger.application");<br> // this one is used to send my own log functions : mytrace(field1, field2...) to jms <br> sentinelleLogger = (Logger) LoggerFactory.getLogger("entr.logger.trace");<br><br>and the idea is : the user has juste to use my static class the same way as logback . MyLogger.trace()..... or MyLogger.Mytrace(...)<br><br>Thanks for any help <br><br><div>> Date: Wed, 6 Jul 2011 12:02:01 +0200<br>> From: ceki@qos.ch<br>> To: logback-user@qos.ch<br>> Subject: Re: [logback-user] Problem with Logback.XML<br>> <br>> Hello Mohammed,<br>> <br>> Could you post a copy of your current logback.xml file? It'll be easier <br>> to talk about multi-step configuration once we have your logback.xml file.<br>> <br>> Cheers,<br>> <br>> On 05/07/2011 10:30 PM, BAKHTI Mohammed wrote:<br>> > Thanks<br>> ><br>> > I have already think about something like this but it's not really nice,<br>> > (if in the future i need to change smething i have to make changes in<br>> > java files)<br>> ><br>> > No one know about how to "exclude component from the default<br>> > configuration" or "multi-step configuration" as slf4j doccumentation said ?<br>> ><br>> > In slf4j they said :<br>> > The only way to obtain output from the listed loggers, is to isolate the<br>> > components invoking these loggers and to exclude them from the default<br>> > configuration. Both logback and log4j allow multi-step configuration. It<br>> > follows that the problematic components should be configured in a second<br>> > step separate from default configuration.<br>> ><br>> ><br>> ><br>> > ------------------------------------------------------------------------<br>> > To: onlymed@hotmail.com; logback-user@qos.ch<br>> > From: djt69@comcast.net<br>> > Subject: Re: [logback-user] Problem with Logback.XML<br>> > Date: Mon, 4 Jul 2011 11:08:05 -0400<br>> ><br>> > The way I got around it with my filter was to create another class with<br>> > a static method that the filter called. The other class had a logger<br>> > instantiated and took care of the logging for the filter.<br>> ><br>> > Sent from my Verizon Wireless Phone<br>> ><br>> > ----- Reply message -----<br>> > From: "BAKHTI Mohammed" <onlymed@hotmail.com><br>> > Date: Mon, Jul 4, 2011 9:47 am<br>> > Subject: [logback-user] Problem with Logback.XML<br>> > To: <djt69@comcast.net>, <logback-user@qos.ch><br>> ><br>> ><br>> > Thanks for the replay :<br>> ><br>> > so how can i deal with this ?<br>> ><br>> > In slf4j they said :<br>> > The only way to obtain output from the listed loggers, is to isolate the<br>> > components invoking these loggers and to exclude them from the default<br>> > configuration. Both logback and log4j allow multi-step configuration. It<br>> > follows that the problematic components should be configured in a second<br>> > step separate from default configuration.<br>> ><br>> > But i don't figure how ? what really i need to do.<br>> ><br>> > Thansk again for any help<br>> ><br>> ><br>> > ------------------------------------------------------------------------<br>> > To: onlymed@hotmail.com; logback-user@qos.ch<br>> > From: djt69@comcast.net<br>> > Subject: Re: [logback-user] Problème with Logback.XML<br>> > Date: Mon, 4 Jul 2011 08:52:24 -0400<br>> ><br>> > If you instantiate a logger in a filter class you'll have the same<br>> > problem. The message is telling you that you can't use a logger in part<br>> > of Logback's init.<br>> ><br>> > Sent from my Verizon Wireless Phone<br>> ><br>> > ----- Reply message -----<br>> > From: "BAKHTI Mohammed" <onlymed@hotmail.com><br>> > Date: Mon, Jul 4, 2011 3:31 am<br>> > Subject: [logback-user] Problème with Logback.XML<br>> > To: <logback-user@qos.ch><br>> ><br>> > Hello,<br>> ><br>> > I just made an API abstraction above logback in order to add specific<br>> > functions in this api i haveall logback functions (juste overrided with<br>> > no changes) and add some other functions (with specific signature):<br>> ><br>> > I created then a file appender and a JMS appender in logback.xml<br>> > (nothing special)<br>> ><br>> > I am using activemq for jms MOM.<br>> ><br>> > The problem is then : when a run a test class with some methodes<br>> > invocation i see this message :<br>> ><br>> > SLF4J: The following loggers will not work becasue they were created<br>> > SLF4J: during the default configuration phase of the underlying logging<br>> > system.<br>> > SLF4J: See also http://www.slf4j.org/codes.html#substituteLogger<br>> > SLF4J: org.apache.activemq.ActiveMQPrefetchPolicy<br>> > SLF4J: org.apache.activemq.jndi.ReadOnlyContext<br>> > SLF4J: org.apache.activemq.transport.tcp.TcpTransportFactory<br>> > SLF4J: org.apache.activemq.util.ServiceSupport<br>> ><br>> > All user logs are logged as expected but i dont see any of activemq (or<br>> > other framework) logs .<br>> ><br>> > i have read the information in slf4j url but don't understund what they<br>> > mean and how to correct this problem in logback .<br>> ><br>> > Thanks for any help<br>> ><br>> ><br>> ><br>> _______________________________________________<br>> Logback-user mailing list<br>> Logback-user@qos.ch<br>> http://qos.ch/mailman/listinfo/logback-user<br></div> </div></div> </div></body>
</html>