0

I have configured DailyRollingFileappender in log4j.xml.During run time in sub project,

  • I need to pass the path for Log file for that specific subProject.
  • I don't want to pass the Path as VM arguments.
  • I have customized DailyRollingFileappender and added a method to set the Path.
  • I want to access the DailyRollingFileappender in main() method of my sub project.
  • I want to modify/add the Parameters for this Existing DailyRollingFileappender.
  • After that log files Should adopt that changes(Path of that Log file) which i had passed as Parameters.
bytecode77
  • 14,163
  • 30
  • 110
  • 141
Sreekanth R
  • 125
  • 1
  • 13
  • Please show your work ... – Fildor Jun 19 '15 at 10:24
  • 1
    possible duplicate of [How can I access the configured Log4J appenders at runtime?](http://stackoverflow.com/questions/1909871/how-can-i-access-the-configured-log4j-appenders-at-runtime) - You can get a reference to the appender at runtime. Take a look at this other question. Alternatively, you need to configure log4j manually using the API (which is more readable than then xml :) – Augusto Jun 19 '15 at 10:40
  • We are using a customized Logging framework which uses log4j.xml we can't change this. I can get the appender, But after adding/modifying the Parameters for that appender what changes i need to do to reflect that changes in that Project. – Sreekanth R Jun 19 '15 at 11:03
  • This Answer could also be helpful: http://stackoverflow.com/a/9003191/982149 – Fildor Jun 19 '15 at 11:20
  • I removed the creation of DailyRollingFileappender from XML and added it by Programatically by setting the filepath and this file path read from CommanLine arguments. Now it is working Properly. Thanks Every one. – Sreekanth R Jun 22 '15 at 06:32

1 Answers1

0
  • I removed the creation of DailyRollingFileappender from XML and added it by Programmatically by setting the filepath

  • This file path set from CommanLine arguments. Now it is working Properly. Thanks Every one

Sreekanth R
  • 125
  • 1
  • 13