You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2014/10/08 15:48:34 UTC

[jira] [Comment Edited] (LOG4J2-870) log4j2 with servlet 3.0 container in WAS8.5 not working

    [ https://issues.apache.org/jira/browse/LOG4J2-870?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14163448#comment-14163448 ] 

Remko Popma edited comment on LOG4J2-870 at 10/8/14 1:48 PM:
-------------------------------------------------------------

Sure. Please see below xml that did not work or it could be my lack of understanding. I have "logger.debug("In Test Servlet");" in test serevlet. Because I have root level as info and in the servlet I am trying to log debug, I did not see it in console and log files ? Not sure but as soon as i chnaged rtoot level as debug, i can see trace log file and in console.

{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="trace">
    <Properties>
        <Property name="log-path">C:/logs/eAdmin</Property>
    </Properties>
    <Appenders>
        <Console name="console-log" target="SYSTEM_OUT">
            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
        </Console>           
        
        <RollingFile name="trace-log" fileName="${log-path}/eAdmin-trace.log"
                     filePattern="${log-path}/eAdmin-trace-%d{yyyy-MM-dd}.log">
            <PatternLayout>
                <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n</pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
            </Policies>
        </RollingFile>
        <RollingFile name="error-log" fileName="${log-path}/eAdmin-error.log"
                     filePattern="${log-path}/eAdmin-error-%d{yyyy-MM-dd}.log">
            <PatternLayout>
                <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n</pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
            </Policies>
        </RollingFile>
    </Appenders>
    <Loggers>
   
        <Root level="info" additivity="false">            
            <appender-ref ref="trace-log" level="debug"/>
            <appender-ref ref="error-log" level="error"/>
            <appender-ref ref="console-log" level="debug"/>
            
        </Root>
    </Loggers>
</Configuration>
{code}



was (Author: sudhakartv):
Sure. Please see below xml that did not work or it could be my lack of understanding. I have "logger.debug("In Test Servlet");" in test serevlet. Because I have root level as info and in the servlet I am trying to log debug, I did not see it in console and log files ? Not sure but as soon as i chnaged rtoot level as debug, i can see trace log file and in console.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="trace">
    <Properties>
        <Property name="log-path">C:/logs/eAdmin</Property>
    </Properties>
    <Appenders>
        <Console name="console-log" target="SYSTEM_OUT">
            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
        </Console>           
        
        <RollingFile name="trace-log" fileName="${log-path}/eAdmin-trace.log"
                     filePattern="${log-path}/eAdmin-trace-%d{yyyy-MM-dd}.log">
            <PatternLayout>
                <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n</pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
            </Policies>
        </RollingFile>
        <RollingFile name="error-log" fileName="${log-path}/eAdmin-error.log"
                     filePattern="${log-path}/eAdmin-error-%d{yyyy-MM-dd}.log">
            <PatternLayout>
                <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n</pattern>
            </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
            </Policies>
        </RollingFile>
    </Appenders>
    <Loggers>
   
        <Root level="info" additivity="false">            
            <appender-ref ref="trace-log" level="debug"/>
            <appender-ref ref="error-log" level="error"/>
            <appender-ref ref="console-log" level="debug"/>
            
        </Root>
    </Loggers>
</Configuration>

> log4j2 with servlet 3.0 container in WAS8.5 not working
> -------------------------------------------------------
>
>                 Key: LOG4J2-870
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-870
>             Project: Log4j 2
>          Issue Type: Question
>          Components: log4j 1.2 emulation
>         Environment: Windows 7, WAS8.5, Java1.6
>            Reporter: Sudhakar
>            Priority: Blocker
>         Attachments: log4j1.png, log4j2.png, log4j3.png, log4j4.png
>
>
> Trying to setup new J2EE project on WAS8.5 using latest Log4J2 jar files. When I run a test servlet, logfiles are not geting created and writing the log.
> http://stackoverflow.com/questions/26164572/log4j2-with-servlet-3-0-container-in-was8-5-not-working
> 1. Log4J2.xml is placed under WEB-INF/classes
> 2.Log4j-api-2.0.2.jar, log4j-core-2.0.2,log4j-web-2.0.2 inluded in the classpath
> if I run DemoLog4J class with main method, I am able to see console and logfiles are written without system property for log4J2.xml location.
>  Please help. Thanks!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org