|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Log4j Logging using IAM3 - variable target file name |
« View previous topic :: View next topic » |
Author |
Message
|
the_one |
Posted: Tue Apr 28, 2015 1:04 pm Post subject: Log4j Logging using IAM3 - variable target file name |
|
|
 Novice
Joined: 16 Dec 2008 Posts: 22 Location: PHX, AZ
|
Hi Everyone,
We are working on creating a new pattern where we have used the IAM3 support pack for logging. This flow will be copied and reused for all similar requirements.
Given below is a snippet from the log4j config file"
Code: |
<appender name="logFileAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/home/wbimb01/LOG/MyFlow1.log"/>
<param name="DatePattern=" value="'.'yyyy-MM-dd-a"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %m - %d %n"/>
|
We need to create a separate log file for each flow, but dont want to create a config file for each flow.
Code: |
value="/home/wbimb01/LOG/MyFlow1.log"/> |
Is it possible to make the log file name dynamic or set this variable from the flow ? in other words, have one single log4j config file for multiple flows and still write to different log files?
The reason this came up was because of the fact that we are using log4j in our Java programs where we pass on the log file name as a JVM parameter.
Code: |
log4j.rootLogger=INFO,tofile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.tofile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.tofile.File=${LOG_FILE}
|
To pass the param to Java -
Code: |
java -DLOG_FILE=/home/wbimb01/MyFlow1.log MainJavaProgram |
_________________ See the marbles of the world, but never forget the drops of oil on the spoon. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 28, 2015 5:29 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Don't know about setting up the dynamic stuff for log4j, never used it much... However it is quite easy when you use java.util.logging... Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 29, 2015 4:25 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Patterns and message flows can not change runtime options of the EG.
If you want your flow to use a dynamically named log file, you should code your JCN to set the name of the log file in whatever logging method you are using - in your case log4j.
But javax.util.logging should always be used instead of log4j. It performs better, and requires less management. And doesn't require runtime options. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|