Skip to content

How to turn off ESAPI logs or change its log level #867

Closed
@raine93

Description

@raine93

I am using ESAPI.Logger=org.owasp.esapi.logging.slf4j.Slf4JLogFactory in ESAPI.properties.

In my web application, I have log4j-api-2.17.1.jar, log4j-core-2.17.1.jar, log4j-slf4j-impl-2.17.1.jar and slf4j-api-1.7.36.jar with a log4j2.xml

The ESAPI logs I manage to see in my web application logs. But when I want to change the ESAPI log level to off it will still show ERROR log.

This is part of my log4j2.xml configuration:

 <Loggers>
        
        <Logger name="org.owasp.esapi" level="off" additivity="false"/>

        <Root level="all">
            <AppenderRef ref="myappLog"  level="INFO" />
        </Root>
        
</Loggers>

The ESAPI logs will still write to myappLog even though I set level to off. When I print out the Fully Qualified Class Name (FQCN) in the log line, the ESAPI log shows:

ERROR : org.owasp.esapi.logging.slf4j.Slf4JLogLevelHandlers$1 - [SECURITY FAILURE Anonymous:@unknown -....

If I log down the FQCN and method name (FQCN|methodname), it will show like this:
ERROR : org.owasp.esapi.logging.slf4j.Slf4JLogLevelHandlers$1|IntrusionException.log() - [SECURITY FAILURE Anonymous:@unknown -....

I did try putting this in log4j2.xml:

<Logger name="org.owasp.esapi.logging.slf4j.Slf4JLogLevelHandlers$1" level="off" additivity="false"/>

but it still does not work

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions