I m trying to change log file path in mule dynamically I have set the system property in an expression component but since log4j2.XML decodes the value at compile time itself it is not getting reflected I have even set monitor interval in log4j.XML but it is not working how to achieve dynamic file path?
相关问题
- I want to trace logs using a Macro multi parameter
- Error message 'No handlers could be found for
- convert logback.xml to log4j.properties
- Django management command doesn't show logging
- Mathjax not rendering TEX formulas dynamically fro
相关文章
- Angular Material Stepper causes mat-formfield to v
- how do I log requests and responses for debugging
- Android Studio doesn't display logs by package
- Stacktrace does not print in Glassfish 4.1 Cluster
- Out of curiosity — why don't logging APIs impl
- Laravel log file based on date
- Java -How to get logger to work in shutdown hook?
- Can the “dynamic” type vary safely in a generic co
If you want run-time changes to logging, you'll need to initialise a new Log4J logger in a Java class. Otherwise using default Mule logging functionality requires you restarting/re-initialising the Mule application.
To make your log file name and path dynamically is to set the path in environment variable.
In the log4j2.xml, you can do something like the following :-
and you set these variables in your
apps.properties
:-or if you want to make it more dynamic, you can pass these value from VM argument as
-DCustomapPath=E:/backup/test/log -DCustomapplicationName=Common-logging-Util
and in Standalone server as
-M-DCustomapplicationName=Common-logging-Util -M-DCustomapPath=E:/backup/test/log
So, now when the application loads you will find the log files generated at the location you mentioned.
But once it's loaded you cannot change the log file path from there as it has already loaded the file location.