2
I have a somewhat confused problem but I will try to explain, I am working on a project that is using some external libraries, and I would like to implement a log, I have seen that in the external packages they use the SLF4J package. So I did a project to test component settings to record in a file and it was going all right, until I tried to put SLF4J in the project I’m working on, because when I set up the log4j in the project it apparently activated all the calls from the external libraries and started to show everything on the console, since it recorded nothing in the log file, apparently it ignores the configuration file, but at the same time this is not true because when I take everything to.
The project is a console and does not use mavem, for network configuration problems here at work. What I want is for him to record the log in the file and preferably without the information of the external libraries, but if it is not possible everything can be logged in. Below follows the log4j.xml file with the sensitive information changed.
The project presents me the following warn "Class path contains Multiple SLF4J bindings", but everything I’ve seen so far had to do with setting up more than one dependency on Maven, but as I said I’m not using Maven.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="threshold" value="DEBUG" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
</layout>
</appender>
<appender name="file" class="org.apache.log4j.FileAppender">
<param name="file" value="d:/temp/app.log" />
<param name="append" value="true" />
<param name="threshold" value="WARN" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p [%c{1}] - %m%n" />
</layout>
</appender>
<root>
<priority value ="debug" />
<appender-ref ref="console" />
<appender-ref ref="file" />
</root>
</log4j:configuration>