You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Jin, Ying" <yi...@vumc.org> on 2022/01/05 02:16:47 UTC
how to use external log4j2 property file
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
Re: how to use external log4j2 property file
Posted by Ralph Goers <ra...@dslextreme.com>.
This is temporary and only enables log4j to debug what is going on with configuration, rollovers, etc. It doesn’t matter where your log4j configuration resides. Please set the property on whatever you use to start your server.
Ralph
> On Jan 5, 2022, at 1:34 PM, Niranjan Rao <nh...@gmail.com> wrote:
>
> On 1/4/22 6:16 PM, 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
>>
>>
>>
>>
> We set log4j configuration in context.xml file the web application. Our log4j configuration file does not even reside on the same server as same configuration file is shared between multiple servers. We set the context property log4jConfiguration and rest of the pieces fall in place automatically. We find this useful rather than setting system property as multiple applications are running.
>
>
> Don't have access to code right now to see if the property is being read by someone else and processed differently.
>
>
> Regards,
>
> Niranjan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: how to use external log4j2 property file
Posted by Niranjan Rao <nh...@gmail.com>.
On 1/4/22 6:16 PM, 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
>
>
>
>
We set log4j configuration in context.xml file the web application. Our
log4j configuration file does not even reside on the same server as same
configuration file is shared between multiple servers. We set the
context property log4jConfiguration and rest of the pieces fall in place
automatically. We find this useful rather than setting system property
as multiple applications are running.
Don't have access to code right now to see if the property is being read
by someone else and processed differently.
Regards,
Niranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: how to use external log4j2 property file
Posted by Ralph Goers <ra...@dslextreme.com>.
Where do you have the log4j jar files? In the application, weblogics’s classpath, or both?
Ralph
> On Jan 4, 2022, at 7:16 PM, Jin, Ying <yi...@vumc.org> 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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org