jenkinsci / syslog-java-client

A Syslog Client written in Java
MIT License
86 stars 73 forks source link

Log4J2 Configuration is being ignored by com.cloudbees.syslog.sender.TcpSyslogMessageSender #130

Open michaelassraf opened 7 months ago

michaelassraf commented 7 months ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Hi,

We're using the syslog library through this maven dep:

       <dependency>
            <groupId>com.cloudbees</groupId>
            <artifactId>syslog-java-client</artifactId>
            <version>1.1.7</version>
            <exclusions>
                <exclusion>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-annotations</artifactId>
                </exclusion>
            </exclusions>
       </dependency>

I'm trying to filter out error log writes such as this one:

com.cloudbees.syslog.sender.TcpSyslogMessageSender - INFO: InetAddress of the Syslog Server have changed, create a new connection. Before=null, new=XXXXXXX

But no matter what I add to the log4j2.xml file, this error persists. Here's log4j2 appenders:

        <Logger name="com.cloudbees.syslog" level="OFF" />
        <Logger name="com.cloudbees.syslog.sender.TcpSyslogMessageSender" level="OFF" />

Michael

Reproduction steps

  1. add the dep
  2. set log appenders to :
        <Logger name="com.cloudbees.syslog" level="OFF" />
        <Logger name="com.cloudbees.syslog.sender.TcpSyslogMessageSender" level="OFF" />
  3. try to send a syslog message with a faulty IP
  4. see the log still writes the error

Expected Results

No log messages when adding:

        <Logger name="com.cloudbees.syslog" level="OFF" />
        <Logger name="com.cloudbees.syslog.sender.TcpSyslogMessageSender" level="OFF" />

Actual Results

Error log writes appear

Anything else?

No response

Are you interested in contributing a fix?

Sure, can do.