Piotr,

On my frontend server, I am still running Java 7.  This is due to limitations 
with the Framework we are using.
Long story short, we are in the process of replacing the java frontend code 
with React. 
An outside firm is handling this, and it will be taking a long time to replace 
all our frontend code.

Because of the java 7 limitation, I am using log4j2 version 2.12.1.
It looks like this version does not support the LevelMatchFilter.
        localhost-startStop-42 ERROR AppenderRef contains an invalid element or 
attribute "LevelMatchFilter"
Is there another option/method available to handle this?

Following is a snip from the log4j2.xml just in case I missed something:
...
  <Loggers>
    <Logger name="edu.uiuc.fs" level="DEBUG"> 
        <AppenderRef ref="DEBUG_LOG" >
            <LevelMatchFilter level="DEBUG"/>
        </AppenderRef>
    </Logger>
      <Root level="info"> 
          <appenderRef ref="CONSOLE" level="fatal" />
          <appenderRef ref="FILE" level="info" />
    </Root>
  </Loggers>


STEVEN M NELLIGAN

-----Original Message-----
From: Piotr P. Karwasz <pi...@mailing.copernik.eu> 
Sent: Tuesday, January 14, 2025 3:47 PM
To: Log4J Users List <log4j-user@logging.apache.org>
Subject: Re: Problem spliting file by logging level.

Hi Steven,

On 14.01.2025 21:44, Nelligan, Steven M wrote:
>    <Loggers>
>      <Logger name="edu.uiuc.fs" level="DEBUG">
>          <!--<level value="warn"/>-->
>          <AppenderRef ref="DEBUG_LOG" />
>      </Logger>
>        <Root level="info">
>            <appenderRef ref="CONSOLE" level="fatal" />
>            <appenderRef ref="FILE" level="info" />
>      </Root>
>    </Loggers>
> </Configuration>
>
> (...)
>
> The file Account_Request.log is correct, but Account-request-debugging.log is 
> wrong.
> Should only contain "DEBUG" level logging.

The `level` attributes in your configuration file act as a threshold filter. If 
you set `level="DEBUG"` you'll end up with all the log event of level DEBUG 
**or more severe** (INFO, WARN, ERROR, FATAL).

To filter out only the log events with level **equal** to DEBUG, you can use a 
`LevelMatchFilter`[1]:


<Logger name="edu.uiuc.fs" level="DEBUG">

   <AppenderRef ref="DEBUG_LOG">

     <LevelMatchFilter level="DEBUG"/>

   </AppenderRef>

</Logger>


Piotr

[1] 
https://urldefense.com/v3/__https://logging.apache.org/log4j/2.x/manual/filters.html*LevelMatchFilter__;Iw!!DZ3fjg!42bTY5qnix7o43ZP7r7wRfWOW7rukPg-oK0R7sjP4XWWC18AJug5s4ITiqPdHI3cBCEgyikjKuLbPX-g5hGvHUP5BQ$
 



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


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

Reply via email to