OK, what you are doing should work. Can you add -Dlog4j2.debug=true to the 
application and provide the output from the Log4j StatusLogger?

Ralph

> On Jan 5, 2022, at 8:33 AM, Jin, Ying <ying....@vumc.org> wrote:
> 
> Hello Ralph,
> 
> In my previous message that I mentioned that we commented out this file 
> located in our project by using "#". The log4j2.properties file on server has 
> no # sign.
> 
> Thanks,
> Jenny
> From: Jin, Ying <ying....@vumc.org>
> Sent: Wednesday, January 5, 2022 8:49 AM
> To: log4j-user@logging.apache.org
> Subject: RE: how to use external log4j2 property file
> 
> Ralph,
> Thanks for your reply! The two log4j jar files were put in the application's 
> WEB-INF/lib folder. Anything needs to be changed in the web.xml? One 
> application uses JDK 11, JSF2.3 and the other one uses JDK 11, GWT2.9 etc.
> Please see below for the log4j2.properties file that was put in the resource 
> folder of the application. We commented it out since we tries to use the 
> server side log4j2.properties file which has the same format and values.
> The "application.log" file can not be generated on server side. The logging 
> output only goes to the weblogic console output.
> #rootLogger.level = DEBUG
> #appenders = writeToFile, console
> 
> #monitorInterval=10
> #appenders=writeToFile, console
> 
> #appender.console.type = Console
> #appender.console.name = STDOUT
> #appender.console.layout.type = PatternLayout
> #appender.console.layout.pattern = %d %5p [%t] (%F:%L) - %m%n
> 
> #appender.writeToFile.type = RollingFile
> #appender.writeToFile.name = File
> #appender.writeToFile.fileName = /app001/applogs/application.log
> 
> #appender.writeToFile.filePattern = ${filename}.%d{yyyy-MM-dd}
> #appender.writeToFile.layout.type = PatternLayout
> #appender.writeToFile.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
> #appender.writeToFile.policies.type = Policies
> #appender.writeToFile.policies.size.type=SizeBasedTriggeringPolicy
> #appender.writeToFile.policies.size.size=20MB
> #appender.writeToFile.strategy.type=DefaultRolloverStrategy
> #appender.writeToFile.strategy.max=10
> 
> #rootLogger.appenderRefs = writeToFile, console
> #rootLogger.appenderRef.console.ref = STDOUT
> #rootLogger.appenderRef.writeToFile.ref = File
> 
> many thanks,
> Jenny
> 
> On 2022/01/05 02:16:47 "Jin, Ying" wrote:
>> Hello,
>> 
>> We have a requirement to use external server-side log4j2.properties file for 
>> our log4j2 upgrade projects. After using the following jar files in the 
>> project and use the code below to configure log4j with an external log4j2 
>> property file. We still see logging output goes to the WebLogic console 
>> instead of the application's log file.
> 
>> 
>> If we put the log4j2.properties file in the project's classpath, the 
>> application log file can be generated on the server. However, we're required 
>> to use the external server side log4j property file.
> 
>> 
>> log4j-api-2.17.0.jar
>> log4j-core-2.17.0.jar
>> 
>> LoggerContext context = (LoggerContext) LogManager.getContext(false);
>> context.setConfigLocation(new File(log4jConfigurationPath).toURI());
>> 
>> Please help shed some light on this. We've spent much time and efforts on 
>> this issue, but still no luck.
>> 
>> Your help is much appreciated,
>> Jenny
>> 
>> 
>> 
>> 


---------------------------------------------------------------------
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