You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by "balajilbk (JIRA)" <lo...@logging.apache.org> on 2014/07/17 14:07:04 UTC
[jira] [Comment Edited] (LOGCXX-439) Dynamic Configuration of
Log4cxx XML with Properties is not proper
[ https://issues.apache.org/jira/browse/LOGCXX-439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14064852#comment-14064852 ]
balajilbk edited comment on LOGCXX-439 at 7/17/14 12:05 PM:
------------------------------------------------------------
Hi Chand Priyankara,
Thanks for the quick response.
Kindly find attached the sample configuration file.
Setup:
Please note the "%properties" in the provided configuration file:
<param name="filePattern" value=".\\Logs\\LoggingFramework\\%properties{processName}\LoggingFramework_%d{yyyyMMdd-HHmmSS-SSS}.log" />
In a sample program:
int main()
{
log4cxx::MDC::put(L"processName",L"SampleAPP");
log4cxx::xml::DOMConfigurator::configureAndWatch(".\Sample_log4cxx.xml");
log4cxx::LoggerPtr logger = LogManager::getLogger(L"LoggingFramework");
while (1)
{LOG4CXX_INFO(logger,"Info Message"); LOG4CXX_ERROR(logger,"Error Message");}
}
compiled the program and started the application.
Log4cxx created a folder called "SampleAPP" under the .\Logs\LoggingFramework directory and started logging.
Reproducing steps:
1. Let the application to continue the writing of the logs into the configured file.
2. change the Level element under logger with the value as "ERROR".
Observation:
1. Reconfiguration is successful but a new file is created under the .\Logs\LoggingFramework instead of .\Logs\LoggingFramework\SampleAPP.
Kindly let me know if you require any clarification.
Thanks in advance.
was (Author: balaji.lbk):
Hi Chand Priyankara,
Thanks for the quick response.
Kindly find attached the sample configuration file.
Setup:
Please note the "%properties" in the provided configuration file:
<param name="filePattern" value=".\\Logs\\LoggingFramework\\%properties{processName}\\LoggingFramework_%d{yyyyMMdd-HHmmSS-SSS}.log" />
In a sample program:
int main()
{
log4cxx::MDC::put(L"processName",L"SampleAPP");
log4cxx::xml::DOMConfigurator::configureAndWatch(".\Sample_log4cxx.xml");
log4cxx::LoggerPtr logger = LogManager::getLogger(L"LoggingFramework");
while (1)
{LOG4CXX_INFO(logger,"Info Message"); LOG4CXX_ERROR(logger,"Error Message");}
}
compiled the program and started the application.
Log4cxx created a folder called "SampleAPP" under the .\Logs\LoggingFramework directory and started logging.
Reproducing steps:
1. Let the application to continue the writing of the logs into the configured file.
2. change the Level element under logger with the value as "ERROR".
Observation:
1. Reconfiguration is successful but a new file is created under the .\Logs\LoggingFramework instead of .\Logs\LoggingFramework\SampleAPP.
Kindly let me know if you require any clarification.
Thanks in advance.
> Dynamic Configuration of Log4cxx XML with Properties is not proper
> ------------------------------------------------------------------
>
> Key: LOGCXX-439
> URL: https://issues.apache.org/jira/browse/LOGCXX-439
> Project: Log4cxx
> Issue Type: Bug
> Components: Configurator
> Affects Versions: 0.10.0
> Environment: Windows XP SP 2/7, Visual Studio 2010.
> Reporter: balajilbk
> Attachments: Sample_log4cxx.xml
>
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> Dear Team,
> Thanks for the wonderful logging framework.
> In my application, the Log4cxx Configuration XML file contain few fields in appender with %properties{Property Name}. The properties are set using log4cxx::MDC::put method in my program. When doing the first time configuration, the DOMConfigurator configures the data properly because of the available thread context.
> But if we update the configuration file dynamically without re-starting the application, the thread is not having any MDC data. Hence the property is empty when re-configuring using dynamic usage of the DOMConfigurator.
> Kindly help me to resolve this issue.
> Thanks in advance.
--
This message was sent by Atlassian JIRA
(v6.2#6252)