logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Jar in WEB-INF/lib not logging
Date Wed, 30 Sep 2015 05:08:02 GMT
Oops, try this instead. I’m pretty sure you don’t want additivity=“true”.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status=“debug" name=“thadGwt" monitorInterval="10">

<Properties>
  <Property name="logpath">/Users/thad/temp</Property>
</Properties>

<Appenders>
  <RollingFile name="RollingFile" fileName="${logpath}/gwtapp.log"
      filePattern="${logpath}/gwtapp_%d{yyyy-MM-dd}.log">
    <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %logger{1}.%method() - %msg%n"/>
    <Policies>
      <TimeBasedTriggeringPolicy />
    </Policies>
    <DefaultRolloverStrategy max="20"/>
  </RollingFile>
</Appenders>

<Loggers>
  <Logger name="com.thad.gwtapp.server" level="debug" additivity=“false">
    <AppenderRef ref="RollingFile"/>
  </Logger>
  <Logger name=“com.thad.image.utils" level="debug" additivity=“false">
    <AppenderRef ref="RollingFile"/>
  </Logger> 
  <Root level=“error”>
     <AppenderRef ref="RollingFile”/>
  </Root>
</Loggers>

</Configuration>


Ralph


> On Sep 29, 2015, at 10:05 PM, Ralph Goers <ralph.goers@dslextreme.com> wrote:
> 
> First, I am making the assumption that you are using the fully qualified class name as
the name of your loggers. You have a logger for com.thad.gwtapp.server so all classes that
are under that package will be logged at the debug level.  You don’t specify a root logger
so any other logger is going to use the default level of error and will log to the console.

> 
> You also have specified strict=true, but the configuration doesn’t match that.
> 
> Please tell me what happens if you use the configuration below
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status=“debug" name=“thadGwt" monitorInterval="10">
> 
> <Properties>
>   <Property name="logpath">/Users/thad/temp</Property>
> </Properties>
> 
> <Appenders>
>   <RollingFile name="RollingFile" fileName="${logpath}/gwtapp.log"
>       filePattern="${logpath}/gwtapp_%d{yyyy-MM-dd}.log">
>     <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %logger{1}.%method() - %msg%n"/>
>     <Policies>
>       <TimeBasedTriggeringPolicy />
>     </Policies>
>     <DefaultRolloverStrategy max="20"/>
>   </RollingFile>
> </Appenders>
> 
> <Loggers>
>   <Logger name="com.thad.gwtapp.server" level="debug" additivity="true">
>     <AppenderRef ref="RollingFile"/>
>   </Logger>
>   <Logger name=“com.thad.image.utils" level="debug" additivity="true">
>     <AppenderRef ref="RollingFile"/>
>   </Logger> 
>   <Root level=“error”>
>      <AppenderRef ref="RollingFile”/>
>   </Root>
> </Loggers>
> 
> </Configuration>
> 
> Thanks,
> Ralph
> 
>> On Sep 29, 2015, at 7:51 PM, Thad Humphries <thad.humphries@gmail.com> wrote:
>> 
>> The default config file (src/main/resources/log4j2-dev.xml) looks like
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Configuration status="debug" strict="true" name="thadGwt"
>>              monitorInterval="10">
>> 
>> <Properties>
>>   <Property name="logpath">/Users/thad/temp</Property>
>> </Properties>
>> 
>> <Appenders>
>>   <RollingFile name="RollingFile" fileName="${logpath}/gwtapp.log"
>>       filePattern="${logpath}/gwtapp_%d{yyyy-MM-dd}.log">
>>     <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level
>> %logger{1}.%method() - %msg%n"/>
>>     <Policies>
>>       <TimeBasedTriggeringPolicy />
>>     </Policies>
>>     <DefaultRolloverStrategy max="20"/>
>>   </RollingFile>
>> </Appenders>
>> 
>> <Loggers>
>>   <Logger name="com.thad.gwtapp.server" level="debug" additivity="true">
>>     <AppenderRef ref="RollingFile"/>
>>   </Logger>
>> </Loggers>
>> 
>> </Configuration>
>> 
>> The class was com.thad.gwtapp.server.ImageToPdf but is now
>> com.thad.image.utils.ImageToPdf. When I run the webapp in Eclipse, logs for
>> com.thad.gwtapp.server.* are there, but not com.thad.image.utils.ImageToPdf.
>> 
>> Nothing but /Configuration/Loggers/Logger/@name holds that servlet package
>> name, and (AFAIK) that is not required--name can be whatever I want. I
>> tried adding a similar <Logger> but with com.thad.image.utils, and tried
>> adding /Configuration/@name = "com.thad.gwtapp.server,
>> com.thad.image.utils".
>> 
>> On Tue, Sep 29, 2015 at 10:13 PM, Ralph Goers <ralph.goers@dslextreme.com>
>> wrote:
>> 
>>> If you could provide some kind of sample with the configuration that would
>>> help.
>>> 
>>> Ralph
>>> 
>>>> On Sep 29, 2015, at 6:42 PM, Thad Humphries <thad.humphries@gmail.com>
>>> wrote:
>>>> 
>>>> Yes, the package name changed. I've not found where to put that in my
>>>> configuration file. I've tried the package attribute to <Configuration>
>>>> (oh, but that is for plugins) and I've tried adding a second <Logger>
>>> with
>>>> the new package as the name attribute and referencing the same Appender.
>>>> Neither work. When I Google this, I get *lots* of Log4j 1 suggestions,
>>> but
>>>> nothing for version 2.
>>>> 
>>>> On Tue, Sep 29, 2015 at 8:59 PM, Ralph Goers <ralph.goers@dslextreme.com
>>>> 
>>>> wrote:
>>>> 
>>>>> By changing the package name did you cause the Logger name to change?
>>> Do
>>>>> you have that logger name configured so that it will log?
>>>>> 
>>>>> Ralph
>>>>> 
>>>>>> On Sep 29, 2015, at 4:37 PM, Thad Humphries <thad.humphries@gmail.com>
>>>>> wrote:
>>>>>> 
>>>>>> I am using Log4j 2.4 to log server actions in my webapp. The logging
>>>>> calls
>>>>>> from WEB-INF/classes are appearing in the webapp's log as expected.
>>>>> Today I
>>>>>> extracted a class from the webapp, built it in a separate package,
and
>>>>>> added a JAR with that package to WEB-INF/lib. Although the logging
is
>>> the
>>>>>> same as before, I no longer see output from this class my webapp's
log.
>>>>> Is
>>>>>> it possible capture this log information with Log4j 2.4? If so, how?
>>>>>> 
>>>>>> --
>>>>>> "Hell hath no limits, nor is circumscrib'd In one self-place; but
where
>>>>> we
>>>>>> are is hell, And where hell is, there must we ever be" --Christopher
>>>>>> Marlowe, *Doctor Faustus* (v. 121-24)
>>>>> 
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> "Hell hath no limits, nor is circumscrib'd In one self-place; but where
>>> we
>>>> are is hell, And where hell is, there must we ever be" --Christopher
>>>> Marlowe, *Doctor Faustus* (v. 121-24)
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>> 
>> 
>> -- 
>> "Hell hath no limits, nor is circumscrib'd In one self-place; but where we
>> are is hell, And where hell is, there must we ever be" --Christopher
>> Marlowe, *Doctor Faustus* (v. 121-24)
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 



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


Mime
View raw message