log.debug not showing on console

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

log.debug not showing on console

ravirajmishra98@gmail.com
Hello,

I have upgraded my log4j to log4j2.

I have created a log4j2.xml file
My system is working perfectly but i am not able see the log.debug(); written in my code on console.

I am pasting my log4j2.xml file.
Please help me to figure out the issue in it.
thanks in advance

---------------------------------------------------------------------------------------------------------

<Configuration status="info" shutdownHook="disable">
    <Properties>
        <Property name="log-name">projectName</Property>
        <Property name="log-home">${catalina.home}/logs</Property>
        <Property name="log-size">500KB </Property>
    </Properties>
    <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
                        <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
                </Console>
   
        <RollingFile name="RollingFile"
                     fileName="${log-home}/${log-name}.log"
                     filePattern="${log-home}/${log-name}-%d{yyyy-MM-dd}-%i.log" >
            <PatternLayout>
                <pattern>%d{MM/dd/yyyy HH:mm:ss,SSS}- %c{10}: %m%n</pattern>
            </PatternLayout>
            <Policies>
                <SizeBasedTriggeringPolicy size="${log-size}" />
            </Policies>
            <DefaultRolloverStrategy>
                <Delete basePath="${log-home}" maxDepth="2">
                    <IfFileName glob="${log-name}*"/>              
                </Delete>
            </DefaultRolloverStrategy>
        </RollingFile>
    </Appenders>
    <Loggers>
                <Root level="info">
                        <AppenderRef ref="Console" />
                        <!-- <AppenderRef ref="file" /> -->
                        <AppenderRef ref="RollingFile" />
                </Root>
                <Logger name="com.package.project" level="DEBUG">
            <appender-ref ref="Console" level="DEBUG"/>
        </Logger>
        <Logger name="com.package.project" level="INFO" additivity="true">
            <appender-ref ref="RollingFile" level="INFO"/>
        </Logger>
        <Logger name="org.apache.cxf.interceptor.LoggingInInterceptor" level="info" additivity="true">
            <appender-ref ref="RollingFile" level="INFO"/>
        </Logger>
         <Logger name="org.apache.cxf.interceptor.LoggingOutInterceptor" level="info" additivity="true">
            <appender-ref ref="RollingFile" level="INFO"/>
        </Logger>
         <Logger name="java.sql.PreparedStatement" level="info" additivity="true">
            <appender-ref ref="RollingFile" level="INFO"/>
        </Logger>
         <Logger name="org.acegisecurity" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>      
        <Logger name="freemarker" level="FATAL" additivity="true">
            <appender-ref ref="RollingFile" level="FATAL"/>
        </Logger>
        <Logger name="org.apache.struts2.util.TextProviderHelper" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>
        <Logger name="org.apache.tiles" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>
        <Logger name="com.ibatis" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>
        <Logger name="java.sql" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>
       <Logger name="com.opensymphony" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>  
        <Logger name="com.opensymphony.xwork2.ognl.OgnlValueStack" level="ERROR" additivity="true">
            <appender-ref ref="RollingFile" level="ERROR"/>
        </Logger>
        </Loggers>
</Configuration>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: log.debug not showing on console

Yasser Zamani


On 10/30/2017 5:45 PM, [hidden email] wrote:
> <Logger name="com.package.project" level="DEBUG">
>              <appender-ref ref="Console" level="DEBUG"/>
>          </Logger>
>          <Logger name="com.package.project" level="INFO" additivity="true">
>              <appender-ref ref="RollingFile" level="INFO"/>
>          </Logger>

I think this is the cause and you should rewrite like below

                <Logger name="com.package.project" level="INFO" additivity="false">
             <appender-ref ref="Console" level="DEBUG"/>
additivity="true">
             <appender-ref ref="RollingFile" level="INFO"/>
         </Logger>

However, it is better to ask at log4j mailing lists such questions.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]