You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Peter DePasquale <pe...@gmail.com> on 2013/04/23 21:37:23 UTC

General config question for Log4J2

Is it possible to use two root loggers, one to capture trace and one to
capture errors (or more generally, two different levels)? If so, can
someone please provide a simple config example? Thanks.

-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

Re: General config question for Log4J2

Posted by Remko Popma <re...@yahoo.com>.
Peter,

I understand your frustration. 
Let me try to help. 
I'm at work now, so please understand if I am unable to reply to your messages immediately. 

First, I tried to do what you did originally (in your March 25th post), which is a root logger and a named logger, each having a different level and configured with a different appender. This didn't work for me (one empty log file).
I'll try to understand exactly what happens and update the docs. 

It looks like the level of the named logger determines the filtering, and after that (if additivity is not switched off), the event is passed to the parent (root) logger without any level checking. If the named logger filters out the event based on its level, the parent (root) logger won't even see the event. 

Meanwhile, I hope that having one single root logger with multiple appender refs configured at different levels:
>      <appender-ref ref="InfoFile" level="info" />
>      <appender-ref ref="TraceFile"/>

solves that issue. 

I'll look at your code posted on git next. 

One thing though:
This project is very much a work in progress. We do our best to create good code and docs, but we are coming at this from a coder's perspective. 
Which is why your feedback is extremely valuable. You are able to point out things that we missed because of your fresh perspective. 
I just wanted to let you know that your questions will improve the product. 

So, thank you. 
(This may be but small compensation for your frustration, but there it is.)

Best regards,
Remko

Sent from my iPhone

On 2013/04/24, at 9:53, Peter DePasquale <pe...@gmail.com> wrote:

> I am having a very difficult time learning the configuration system and am
> very frustrated by the documentation. I had hoped to learn the system well
> enough to possibly contribute to the project with respect to a tutorial or
> other documentation, but I've concluded that I can no longer spend so much
> time trying to work with log4j2 and not focus on my project, which sorely
> needed logging.
> 
> I wanted to next learn where the documentation for this like the following
> are discussed:
>      <appender-ref ref="InfoFile" level="info" />
>      <appender-ref ref="TraceFile"/>
> 
> But I can't find anything about this either. My questions seem to only lead
> to more questions and no answers.
> 
> I'm sorry, but even despite my simple use cases where I'd like to separate
> out types of logging into different files, and with my earlier unsolved
> issues related to L4J's application for a web app in Tomcat, I'm very
> frustrated.
> 
> Perhaps someday the project documentation will mature to the point where I
> can learn how to use the software from a novice's (to logging) perspective.
> 
> 
> On Tue, Apr 23, 2013 at 8:46 PM, Ralph Goers <ra...@dslextreme.com>wrote:
> 
>> Your trace file will also contain info and above. From Peter's question I
>> understood him to mean he only wants events at that level.  We don't have a
>> filter that does that specifically so I used two threshold filters to do it.
>> 
>> Ralph
>> 
>> On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:
>> 
>>> I don't think the docs have an example yet. This one worked for me:
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <configuration status="WARN">
>>> <appenders>
>>>   <File name="InfoFile" fileName="level-info.log">
>>>     <PatternLayout>
>>>       <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>>>     </PatternLayout>
>>>   </File>
>>>   <File name="TraceFile" fileName="level-trace.log">
>>>     <PatternLayout>
>>>       <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>>>     </PatternLayout>
>>>   </File>
>>> </appenders>
>>> <loggers>
>>>   <root level="trace">
>>>     <appender-ref ref="InfoFile" level="info" />
>>>     <appender-ref ref="TraceFile"/>
>>>   </root>
>>> </loggers>
>>> </configuration>
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>> On 2013/04/24, at 9:22, Peter DePasquale <pe...@gmail.com>
>> wrote:
>>> 
>>>> Can you point me to an example in the documentation?  I didn't see
>> anything
>>>> like that in there, that I recall...
>>>> 
>>>> 
>>>> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <
>> ralph.goers@dslextreme.com>wrote:
>>>> 
>>>>> You cannot have two root loggers but you can have multiple
>> appender-refs
>>>>> on them.  Each appender-ref can have its own log level so I believe
>> you get
>>>>> the same behavior that you are looking for.
>>>>> 
>>>>> Ralph
>>>>> 
>>>>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>>>>> 
>>>>>> Is it possible to use two root loggers, one to capture trace and one
>> to
>>>>>> capture errors (or more generally, two different levels)? If so, can
>>>>>> someone please provide a simple config example? Thanks.
>>>>>> 
>>>>>> --
>>>>>> Peter J. DePasquale, Ph.D.
>>>>>> Department of Computer Science
>>>>>> The College of New Jersey
>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>> (p) 609-771-2806
>>>>>> (f) 609-637-5190
>>>>>> (o) Holman Hall - Room 238
>>>>>> (l) Holman Hall - Room 255
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255

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


Re: General config question for Log4J2

Posted by Peter DePasquale <pe...@gmail.com>.
I am having a very difficult time learning the configuration system and am
very frustrated by the documentation. I had hoped to learn the system well
enough to possibly contribute to the project with respect to a tutorial or
other documentation, but I've concluded that I can no longer spend so much
time trying to work with log4j2 and not focus on my project, which sorely
needed logging.

I wanted to next learn where the documentation for this like the following
are discussed:
      <appender-ref ref="InfoFile" level="info" />
      <appender-ref ref="TraceFile"/>

But I can't find anything about this either. My questions seem to only lead
to more questions and no answers.

I'm sorry, but even despite my simple use cases where I'd like to separate
out types of logging into different files, and with my earlier unsolved
issues related to L4J's application for a web app in Tomcat, I'm very
frustrated.

Perhaps someday the project documentation will mature to the point where I
can learn how to use the software from a novice's (to logging) perspective.


On Tue, Apr 23, 2013 at 8:46 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> Your trace file will also contain info and above. From Peter's question I
> understood him to mean he only wants events at that level.  We don't have a
> filter that does that specifically so I used two threshold filters to do it.
>
> Ralph
>
> On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:
>
> > I don't think the docs have an example yet. This one worked for me:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <configuration status="WARN">
> >  <appenders>
> >    <File name="InfoFile" fileName="level-info.log">
> >      <PatternLayout>
> >        <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
> >      </PatternLayout>
> >    </File>
> >    <File name="TraceFile" fileName="level-trace.log">
> >      <PatternLayout>
> >        <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
> >      </PatternLayout>
> >    </File>
> >  </appenders>
> >  <loggers>
> >    <root level="trace">
> >      <appender-ref ref="InfoFile" level="info" />
> >      <appender-ref ref="TraceFile"/>
> >    </root>
> >  </loggers>
> > </configuration>
> >
> >
> > Sent from my iPhone
> >
> > On 2013/04/24, at 9:22, Peter DePasquale <pe...@gmail.com>
> wrote:
> >
> >> Can you point me to an example in the documentation?  I didn't see
> anything
> >> like that in there, that I recall...
> >>
> >>
> >> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <
> ralph.goers@dslextreme.com>wrote:
> >>
> >>> You cannot have two root loggers but you can have multiple
> appender-refs
> >>> on them.  Each appender-ref can have its own log level so I believe
> you get
> >>> the same behavior that you are looking for.
> >>>
> >>> Ralph
> >>>
> >>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
> >>>
> >>>> Is it possible to use two root loggers, one to capture trace and one
> to
> >>>> capture errors (or more generally, two different levels)? If so, can
> >>>> someone please provide a simple config example? Thanks.
> >>>>
> >>>> --
> >>>> Peter J. DePasquale, Ph.D.
> >>>> Department of Computer Science
> >>>> The College of New Jersey
> >>>> (e) depasqua [at] tcnj [dot] edu
> >>>> (p) 609-771-2806
> >>>> (f) 609-637-5190
> >>>> (o) Holman Hall - Room 238
> >>>> (l) Holman Hall - Room 255
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>
> >>
> >> --
> >> Peter J. DePasquale, Ph.D.
> >> Department of Computer Science
> >> The College of New Jersey
> >> (e) depasqua [at] tcnj [dot] edu
> >> (p) 609-771-2806
> >> (f) 609-637-5190
> >> (o) Holman Hall - Room 238
> >> (l) Holman Hall - Room 255
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

Re: General config question for Log4J2

Posted by Ralph Goers <ra...@dslextreme.com>.
The approach I did is documented (perhaps poorly) at http://logging.apache.org/log4j/2.x/manual/configuration.html in the section titled configuring filters.  Adding the level to the appender-ref may not be documented. That was missed when the feature was added.

Ralph

On Apr 23, 2013, at 5:50 PM, Remko Popma wrote:

> I see. I understood Peter's question differently. Let's hope one of our answers solves his problem! :-)
> 
> Sent from my iPhone
> 
> On 2013/04/24, at 9:46, Ralph Goers <ra...@dslextreme.com> wrote:
> 
>> Your trace file will also contain info and above. From Peter's question I understood him to mean he only wants events at that level.  We don't have a filter that does that specifically so I used two threshold filters to do it.
>> 
>> Ralph
>> 
>> On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:
>> 
>>> I don't think the docs have an example yet. This one worked for me:
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <configuration status="WARN">
>>> <appenders>
>>>  <File name="InfoFile" fileName="level-info.log">
>>>    <PatternLayout>
>>>      <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>>>    </PatternLayout>
>>>  </File>
>>>  <File name="TraceFile" fileName="level-trace.log">
>>>    <PatternLayout>
>>>      <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>>>    </PatternLayout>
>>>  </File>
>>> </appenders>
>>> <loggers>
>>>  <root level="trace">
>>>    <appender-ref ref="InfoFile" level="info" />
>>>    <appender-ref ref="TraceFile"/>
>>>  </root>
>>> </loggers>
>>> </configuration>
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>> On 2013/04/24, at 9:22, Peter DePasquale <pe...@gmail.com> wrote:
>>> 
>>>> Can you point me to an example in the documentation?  I didn't see anything
>>>> like that in there, that I recall...
>>>> 
>>>> 
>>>> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <ra...@dslextreme.com>wrote:
>>>> 
>>>>> You cannot have two root loggers but you can have multiple appender-refs
>>>>> on them.  Each appender-ref can have its own log level so I believe you get
>>>>> the same behavior that you are looking for.
>>>>> 
>>>>> Ralph
>>>>> 
>>>>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>>>>> 
>>>>>> Is it possible to use two root loggers, one to capture trace and one to
>>>>>> capture errors (or more generally, two different levels)? If so, can
>>>>>> someone please provide a simple config example? Thanks.
>>>>>> 
>>>>>> --
>>>>>> Peter J. DePasquale, Ph.D.
>>>>>> Department of Computer Science
>>>>>> The College of New Jersey
>>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>>> (p) 609-771-2806
>>>>>> (f) 609-637-5190
>>>>>> (o) Holman Hall - Room 238
>>>>>> (l) Holman Hall - Room 255
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>> 
>>>> 
>>>> -- 
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 


Re: General config question for Log4J2

Posted by Remko Popma <re...@yahoo.com>.
I see. I understood Peter's question differently. Let's hope one of our answers solves his problem! :-)

Sent from my iPhone

On 2013/04/24, at 9:46, Ralph Goers <ra...@dslextreme.com> wrote:

> Your trace file will also contain info and above. From Peter's question I understood him to mean he only wants events at that level.  We don't have a filter that does that specifically so I used two threshold filters to do it.
> 
> Ralph
> 
> On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:
> 
>> I don't think the docs have an example yet. This one worked for me:
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configuration status="WARN">
>> <appenders>
>>   <File name="InfoFile" fileName="level-info.log">
>>     <PatternLayout>
>>       <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>>     </PatternLayout>
>>   </File>
>>   <File name="TraceFile" fileName="level-trace.log">
>>     <PatternLayout>
>>       <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>>     </PatternLayout>
>>   </File>
>> </appenders>
>> <loggers>
>>   <root level="trace">
>>     <appender-ref ref="InfoFile" level="info" />
>>     <appender-ref ref="TraceFile"/>
>>   </root>
>> </loggers>
>> </configuration>
>> 
>> 
>> Sent from my iPhone
>> 
>> On 2013/04/24, at 9:22, Peter DePasquale <pe...@gmail.com> wrote:
>> 
>>> Can you point me to an example in the documentation?  I didn't see anything
>>> like that in there, that I recall...
>>> 
>>> 
>>> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <ra...@dslextreme.com>wrote:
>>> 
>>>> You cannot have two root loggers but you can have multiple appender-refs
>>>> on them.  Each appender-ref can have its own log level so I believe you get
>>>> the same behavior that you are looking for.
>>>> 
>>>> Ralph
>>>> 
>>>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>>>> 
>>>>> Is it possible to use two root loggers, one to capture trace and one to
>>>>> capture errors (or more generally, two different levels)? If so, can
>>>>> someone please provide a simple config example? Thanks.
>>>>> 
>>>>> --
>>>>> Peter J. DePasquale, Ph.D.
>>>>> Department of Computer Science
>>>>> The College of New Jersey
>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>> (p) 609-771-2806
>>>>> (f) 609-637-5190
>>>>> (o) Holman Hall - Room 238
>>>>> (l) Holman Hall - Room 255
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>>> -- 
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
> 
> 
> ---------------------------------------------------------------------
> 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


Re: General config question for Log4J2

Posted by Ralph Goers <ra...@dslextreme.com>.
Your trace file will also contain info and above. From Peter's question I understood him to mean he only wants events at that level.  We don't have a filter that does that specifically so I used two threshold filters to do it.

Ralph

On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:

> I don't think the docs have an example yet. This one worked for me:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration status="WARN">
>  <appenders>
>    <File name="InfoFile" fileName="level-info.log">
>      <PatternLayout>
>        <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>      </PatternLayout>
>    </File>
>    <File name="TraceFile" fileName="level-trace.log">
>      <PatternLayout>
>        <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
>      </PatternLayout>
>    </File>
>  </appenders>
>  <loggers>
>    <root level="trace">
>      <appender-ref ref="InfoFile" level="info" />
>      <appender-ref ref="TraceFile"/>
>    </root>
>  </loggers>
> </configuration>
> 
> 
> Sent from my iPhone
> 
> On 2013/04/24, at 9:22, Peter DePasquale <pe...@gmail.com> wrote:
> 
>> Can you point me to an example in the documentation?  I didn't see anything
>> like that in there, that I recall...
>> 
>> 
>> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <ra...@dslextreme.com>wrote:
>> 
>>> You cannot have two root loggers but you can have multiple appender-refs
>>> on them.  Each appender-ref can have its own log level so I believe you get
>>> the same behavior that you are looking for.
>>> 
>>> Ralph
>>> 
>>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>>> 
>>>> Is it possible to use two root loggers, one to capture trace and one to
>>>> capture errors (or more generally, two different levels)? If so, can
>>>> someone please provide a simple config example? Thanks.
>>>> 
>>>> --
>>>> Peter J. DePasquale, Ph.D.
>>>> Department of Computer Science
>>>> The College of New Jersey
>>>> (e) depasqua [at] tcnj [dot] edu
>>>> (p) 609-771-2806
>>>> (f) 609-637-5190
>>>> (o) Holman Hall - Room 238
>>>> (l) Holman Hall - Room 255
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> -- 
>> Peter J. DePasquale, Ph.D.
>> Department of Computer Science
>> The College of New Jersey
>> (e) depasqua [at] tcnj [dot] edu
>> (p) 609-771-2806
>> (f) 609-637-5190
>> (o) Holman Hall - Room 238
>> (l) Holman Hall - Room 255


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


Re: General config question for Log4J2

Posted by Remko Popma <re...@yahoo.com>.
I don't think the docs have an example yet. This one worked for me:

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="WARN">
  <appenders>
    <File name="InfoFile" fileName="level-info.log">
      <PatternLayout>
        <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
      </PatternLayout>
    </File>
    <File name="TraceFile" fileName="level-trace.log">
      <PatternLayout>
        <pattern>%d %-5p %c{1.} [%t] %m %ex%n</pattern>
      </PatternLayout>
    </File>
  </appenders>
  <loggers>
    <root level="trace">
      <appender-ref ref="InfoFile" level="info" />
      <appender-ref ref="TraceFile"/>
    </root>
  </loggers>
</configuration>


Sent from my iPhone

On 2013/04/24, at 9:22, Peter DePasquale <pe...@gmail.com> wrote:

> Can you point me to an example in the documentation?  I didn't see anything
> like that in there, that I recall...
> 
> 
> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <ra...@dslextreme.com>wrote:
> 
>> You cannot have two root loggers but you can have multiple appender-refs
>> on them.  Each appender-ref can have its own log level so I believe you get
>> the same behavior that you are looking for.
>> 
>> Ralph
>> 
>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>> 
>>> Is it possible to use two root loggers, one to capture trace and one to
>>> capture errors (or more generally, two different levels)? If so, can
>>> someone please provide a simple config example? Thanks.
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255

Re: General config question for Log4J2

Posted by Ralph Goers <ra...@dslextreme.com>.
Actually, in reconsidering your question the solution is going to be a bit messy. I haven't tried it but you should be able to do:


<root level="trace">
  <appender-ref ref="debugLog">
    <thresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
    <thresholdFilter level="debug" onMatch="ACCEPT" on Mismatch="DENY"/>
  </appender-ref>
  <appender-ref ref="errorLog">
    <thresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
    <thresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
  </appender-ref>

<root>

The first threshold filter will discard events with a logging level higher than what your want.  The second discards events lower than what you want.

Ralph


On Apr 23, 2013, at 5:22 PM, Peter DePasquale wrote:

> Can you point me to an example in the documentation?  I didn't see anything
> like that in there, that I recall...
> 
> 
> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <ra...@dslextreme.com>wrote:
> 
>> You cannot have two root loggers but you can have multiple appender-refs
>> on them.  Each appender-ref can have its own log level so I believe you get
>> the same behavior that you are looking for.
>> 
>> Ralph
>> 
>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>> 
>>> Is it possible to use two root loggers, one to capture trace and one to
>>> capture errors (or more generally, two different levels)? If so, can
>>> someone please provide a simple config example? Thanks.
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255


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


Re: General config question for Log4J2

Posted by Peter DePasquale <pe...@gmail.com>.
Can you point me to an example in the documentation?  I didn't see anything
like that in there, that I recall...


On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> You cannot have two root loggers but you can have multiple appender-refs
> on them.  Each appender-ref can have its own log level so I believe you get
> the same behavior that you are looking for.
>
> Ralph
>
> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>
> > Is it possible to use two root loggers, one to capture trace and one to
> > capture errors (or more generally, two different levels)? If so, can
> > someone please provide a simple config example? Thanks.
> >
> > --
> > Peter J. DePasquale, Ph.D.
> > Department of Computer Science
> > The College of New Jersey
> > (e) depasqua [at] tcnj [dot] edu
> > (p) 609-771-2806
> > (f) 609-637-5190
> > (o) Holman Hall - Room 238
> > (l) Holman Hall - Room 255
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
Peter J. DePasquale, Ph.D.
Department of Computer Science
The College of New Jersey
(e) depasqua [at] tcnj [dot] edu
(p) 609-771-2806
(f) 609-637-5190
(o) Holman Hall - Room 238
(l) Holman Hall - Room 255

Re: General config question for Log4J2

Posted by Ralph Goers <ra...@dslextreme.com>.
You cannot have two root loggers but you can have multiple appender-refs on them.  Each appender-ref can have its own log level so I believe you get the same behavior that you are looking for.

Ralph

On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:

> Is it possible to use two root loggers, one to capture trace and one to
> capture errors (or more generally, two different levels)? If so, can
> someone please provide a simple config example? Thanks.
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255


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