Tag Archives: log4j

[Solved] was server Upgrade log4j to 2.17.0 error

Because log4j has a jndi vulnerability, the company needs to upgrade log4j to version 2.17.0. After the upgrade, the local test is no problem, but the following error is reported when it is not in the test environment:

com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl scanJAR unable to open input stream for resource log4j-core-2.17.0.jar

 

Modify the amm.filter.properties file under the /opt/IBM/WebSphere/AppServer/properties file

Add the corresponding jar in Ignore-Scanning-Archives or add the corresponding package path in Ignore-Scanning-Packages to eliminate scanning to solve the problem.

The corresponding class file under these two attributes can be modified when there is no annotation.

[How to Solve] log4j: WARN Please initialize the log4j system properly

Using log4j, the alarms are as follows.

log4j: WARN No appenders could be found for logger

log4j: WARN Please initialize the log4j system properly.

maven project, build the source folder “/src/test/resources” under the project.

Create a file log4j.properties under the above path.

Copy the following content to log4j.properties

# For Testing Guys
# Set root logger level to error
log4j.rootLogger=INFO, Console

###### Console appender definition #######

# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{3}] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n

###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=spring.log
log4j.appender.File.Append=false
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n
log4j.rootLogger=debug, stdout, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%5p - %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=firestorm.log

log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

log4j.logger.com.codefutures=DEBUG