[logback-user] Separating the logging-output of libraries in tomcat/shared

toxel anton.kudinov at gmail.com
Fri Mar 5 11:22:05 CET 2010


Problem was in 
<File>${catalina.home}/logs/tbank/tbank-${contextName}.d{yyyy-MM-dd}.log.zip</File> 

if I use 
<FileNamePattern>tbank-${contextName}.%d{yyyy-MM-dd}.log.zip
it's work




toxel wrote:
> 
> Strange situation - directory and files for log dont't created. (INFO
> messages disappeared  after I resolving WARN problems)
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <configuration scan="true" scanPeriod="30 seconds" debug="false">
> 	<appender name="SIFT-LOG"
> class="ch.qos.logback.classic.sift.SiftingAppender">
> 		<discriminator
> 			class="utils.common.logging.JNDIBasedContextDiscriminator">
> 			<DefaultValue>unknown</DefaultValue>
> 		</discriminator>
> 		<sift>
> 			<appender name="logfile-${contextName}"
> 				class="ch.qos.logback.core.rolling.RollingFileAppender">
> 				<File>${catalina.home}/logs/tbank/tbank-${contextName}.log</File>
> 				<rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> 				
> <FileNamePattern>tbank-${contextName}.d{yyyy-MM-dd}.log.zip</FileNamePattern>
> 					<MaxHistory>60</MaxHistory>
> 				</rollingPolicy>
> 				<layout class="ch.qos.logback.classic.PatternLayout">
> 					<Pattern>%d [%thread] %-5level %logger{35} - %msg%n
> 			</Pattern>
> 				</layout>
> 				<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
> 					<level>DEBUG</level>
> 				</filter>
> 				<Encoding>utf-8</Encoding>
> 			</appender>
> 		</sift>
> 	</appender>
> 
> 	<appender name="SIFT-ERR"
> class="ch.qos.logback.classic.sift.SiftingAppender">
> 		<discriminator
> 			class="utils.common.logging.JNDIBasedContextDiscriminator">
> 			<DefaultValue>unknown</DefaultValue>
> 		</discriminator>
> 		<sift>
> 			<appender name="errfile-${contextName}"
> 				class="ch.qos.logback.core.rolling.RollingFileAppender">
> 				<File>${catalina.home}/logs/tbank/tbank-${contextName}-error.log
> 				</File>
> 				<!rollingPolicy
> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
> 					<FileNamePattern>tbank-${contextName}-error.d{yyyy-MM-dd}.log.zip
> 					</FileNamePattern>
> 					<MaxHistory>60</MaxHistory>
> 				</rollingPolicy>
> 
> 				<layout class="ch.qos.logback.classic.PatternLayout">
> 					<Pattern>%d [%thread] %-5level %logger{35} - %msg%n
> 			</Pattern>
> 				</layout>
> 				<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
> 					<level>WARN</level>
> 				</filter>
> 				<Encoding>utf-8</Encoding>
> 			</appender>
> 		</sift>
> 	</appender>
> 
> 
> 	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
> 		<layout class="ch.qos.logback.classic.PatternLayout">
> 			<Pattern>%d [%thread] %-5level %logger{35} - %msg%n
> 			</Pattern>
> 		</layout>
> 		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
> 			<level>WARN</level>
> 		</filter>
> 		<Encoding>utf-8</Encoding>
> 	</appender>
> 
> 	<logger name="ru" level="DEBUG" />
> 	<logger name="org.springframework" level="INFO" />
> 	<logger name="org.springframework.web.filter" level="DEBUG" />
> 	<logger
> 	
> name="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"
> 		level="DEBUG" />
> 	<logger name="org.springframework.ws.client.MessageTracing.sent"
> 		level="TRACE" />
> 	<logger name="org.apache.commons.httpclient" level="DEBUG" />
> 	<logger name="org.springframework.ws.server.MessageTracing"
> 		level="DEBUG" />
> 	<logger name="httpclient.wire.content" level="DEBUG" />
> 	<logger name="org.springframework.ws.client.MessageTracing.received"
> 		level="DEBUG" />
> 	<logger name="httpclient.wire.header" level="DEBUG" />
> 	<root level="WARN">
> 		<appender-ref ref="STDOUT" />
> 		<appender-ref ref="SIFT-LOG" />
> 		<appender-ref ref="SIFT-ERR" />
> 	</root>
> </configuration>
> 
> 
> 
> Ceki Gulcu wrote:
>> 
>> 
>> There is no way to filter logback's internal messages by level. In
>> general, 
>> logback will output its internal state after it is configured and only in
>> case 
>> of errors or if you set debug=true in the <configuration> element.
>> 
>> Have you attached a status listener in your configuration file? For
>> example, do 
>> you have the following in your config file?
>> 
>> <statusListener
>>       class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
>> 
>> If you do, remove it.
>> 
>> See also the docs: http://logback.qos.ch/manual/configuration.html
>> 
>> 
>> 
>> On 05/03/2010 9:58 AM, toxel wrote:
>>>
>>>
>>> Thank you very match for you help. It's work.
>>> But I have many INFO messages in my catalina.out
>>>
>>> INFO: Deploying web application archive tbank-ps#tbank-mailru.war
>>> 11:36:54,837 |-INFO in
>>> ch.qos.logback.classic.joran.action.ConfigurationAction - debug
>>> attribute
>>> not set
>>> 11:36:54,837 |-INFO in
>>> ch.qos.logback.classic.joran.action.ConfigurationAction - Adding
>>> ReconfigureOnChangeFilter as a turbo filter
>>> 11:36:54,837 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
>>> About to instantiate appender of type
>>> [ch.qos.logback.classic.sift.SiftingAppender]
>>> 11:36:54,837 |-INFO in ch.qos.logback.core.joran.action.AppenderAction -
>>> Naming appender as [SIFT-LOG]
>>> .....
>>> 11:36:54,840 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction
>>> -
>>> Setting level of logger [httpclient.wire.content] to DEBUG
>>> 11:36:54,840 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction
>>> -
>>> Setting additivity of logger [httpclient.wire.content] to true
>>> 11:36:54,840 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction
>>> -
>>> Setting level of logger
>>> [org.springframework.ws.client.MessageTracing.received] to DEBUG
>>> 11:36:54,840 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction
>>> -
>>> Setting additivity of logger
>>> [org.springframework.ws.client.MessageTracing.received] to true
>>> 11:36:54,840 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction
>>> -
>>> Setting level of logger [httpclient.wire.header] to DEBUG
>>> 11:36:54,840 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction
>>> -
>>> Setting additivity of logger [httpclient.wire.header] to true
>>> 11:36:54,840 |-INFO in
>>> ch.qos.logback.classic.joran.action.RootLoggerAction
>>> - Setting level of ROOT logger to WARN
>>> 11:36:54,840 |-INFO in
>>> ch.qos.logback.core.joran.action.AppenderRefAction -
>>> Attaching appender named [STDOUT] to Logger[ROOT]
>>> 11:36:54,841 |-INFO in
>>> ch.qos.logback.core.joran.action.AppenderRefAction -
>>> Attaching appender named [SIFT-LOG] to Logger[ROOT]
>>> 11:36:54,841 |-INFO in
>>> ch.qos.logback.core.joran.action.AppenderRefAction -
>>> Attaching appender named [SIFT-ERR] to Logger[ROOT]
>>>
>>> How can I remove this messages and log only WARN level ?
>>> I must configure level for logback ?
>>>
>>>
>>>
>>> Ceki Gulcu wrote:
>>>>
>>>>
>>>> 1) You can only have *one *nested-appender within SiftingAppender.
>>>>
>>>> To manage *two* nested appender families, create *two* sifted
>>>> appenders.
>>>>
>>>> 2)<FileNamePattern>tbank-${contextName}.%d{yyyy-MM-dd}.log.zip looks
>>>> suspicious, it should probably be
>>>> <File>${catalina.home}/logs/tbank/tbank-${contextName}.d{yyyy-MM-dd}.log.zip</File>
>>>>
>>>> 3) Since you are going to share the same configuration file between
>>>> all contexts, you should override the JNDIContextSelector convention
>>>> and explicitly define the "logback/configuration-resource" to point to
>>>> the same file.  Include the following in each web.xml. The path to the
>>>> logback should be the same (shared).
>>>>
>>>> <env-entry>
>>>>     <env-entry-name>logback/configuration-resource</env-entry-name>
>>>>     <env-entry-type>java.lang.String</env-entry-type>
>>>>     <env-entry-value>c:/my_shared_logback_config.xml</env-entry-value>
>>>> </env-entry>
>>>>
>>>> Alternatively you could follow the convention and have different
>>>> logback configuration files with identical contents (which is rather
>>>> silly in this case).
>>>>
>>>> I hope this helps,
>>>>
>>>> On 05/03/2010 9:32 AM, toxel wrote:
>>>>>
>>>>> I read in manual (http://logback.qos.ch/manual/loggingSeparation.html)
>>>>> that :
>>>>> "
>>>>> Assuming you have enabled ContextJNDISelector, logging for Kenobi will
>>>>> be
>>>>> done using a logger context named "kenobi". Moreover, the "kenobi"
>>>>> logger
>>>>> context will be initialized by convention using the configuration file
>>>>> called logback-kenobi.xml which should be packaged within Kenobi
>>>>> web-application under the WEB-INF/classes folder.
>>>>> "
>>>>>
>>>>> And 2nd question:
>>>>> can I use next configuration for SIFT appender - with two underlying
>>>>> appenders
>>>>>
>>>>> 	<appender name="SIFT"
>>>>> class="ch.qos.logback.classic.sift.SiftingAppender">
>>>>> 		<discriminator
>>>>> 			class="utils.common.logging.JNDIBasedContextDiscriminator">
>>>>> 			<DefaultValue>unknown</DefaultValue>
>>>>> 		</discriminator>
>>>>> 		<sift>
>>>>> 			<appender name="logfile-${contextName}"
>>>>> 				class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>>> 				<File>${catalina.home}/logs/tbank/tbank-${contextName}.log</File>
>>>>> 				<rollingPolicy
>>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>>> 					<FileNamePattern>tbank-${contextName}.%d{yyyy-MM-dd}.log.zip
>>>>> 					</FileNamePattern>
>>>>> 					<MaxHistory>60</MaxHistory>
>>>>> 				</rollingPolicy>
>>>>> 				<layout class="ch.qos.logback.classic.PatternLayout">
>>>>> 					<Pattern>%d [%thread] %-5level %logger{35} - %msg%n
>>>>> 			</Pattern>
>>>>> 				</layout>
>>>>> 				<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>>>>> 					<level>DEBUG</level>
>>>>> 				</filter>
>>>>> 				<Encoding>utf-8</Encoding>
>>>>> 			</appender>
>>>>>
>>>>> 			<appender name="errfile-${contextName}"
>>>>> 				class="ch.qos.logback.core.rolling.RollingFileAppender">
>>>>> 				<File>${catalina.home}/logs/tbank/tbank-${contextName}-error.log
>>>>> 				</File>
>>>>> 				<rollingPolicy
>>>>> class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
>>>>> 				
>>>>> <FileNamePattern>tbank-${contextName}-error.%d{yyyy-MM-dd}.log.zip
>>>>> 					</FileNamePattern>
>>>>> 					<MaxHistory>60</MaxHistory>
>>>>> 				</rollingPolicy>
>>>>>
>>>>> 				<layout class="ch.qos.logback.classic.PatternLayout">
>>>>> 					<Pattern>%d [%thread] %-5level %logger{35} - %msg%n
>>>>> 			</Pattern>
>>>>> 				</layout>
>>>>> 				<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
>>>>> 					<level>WARN</level>
>>>>> 				</filter>
>>>>> 				<Encoding>utf-8</Encoding>
>>>>> 			</appender>
>>>>> 		</sift>
>>>>> 	</appender>
>>>>>
>> _______________________________________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://qos.ch/mailman/listinfo/logback-user
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Separating-the-logging-output-of-libraries-in-tomcat-shared-tp27715205p27792216.html
Sent from the Logback User mailing list archive at Nabble.com.



More information about the Logback-user mailing list