cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Log4j creates multiple log files when only wanting one

berny2U
12-Amethyst

Log4j creates multiple log files when only wanting one

Hi
We have a number of customization api's running in Windchill that take effect when promotion occurs. As this is generating a fair amount of logging I decided to put this in a separated log file.
I use next configuration for this (log4jMethodServer.properties):

berny2U_0-1665751882568.png

This creates also a log file for both method server processes (javaMS.exe) and one for the background method server (avaBGM.exe). The loggers with id 21024 & 14912 are method server logs that I do not want. The are empty too.

berny2U_1-1665752238309.png

What am I doing wrong to get these extra logfiles for the method servers? I am only interested in deriving the output from original the BM method server to the CustomLogger.

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:berny2U)

Hi @berny2U 

I have to add that I set my background server by my own settings called BGMethodServer

This is a reason why you see different setting. 

 

The point is to set -Dlog4j2.configurationFile\=$(wt.method.log4j.config)  separately to a background method server.

This can be little bit complicated but it is possible. 

 

in your case there is a line with wt.manager.cmd.BackgroundMethodServer=$(wt.manager.cmd.MethodServer) wt.method.serviceName\={1} wt.queue.executeQueues\=true wt.queue.queueGroup\={5} wt.intersvrcom.sitePing\=false wt.adapter.enabled\=false wt.method.minPort\=$(wt.method.bg.minPort) wt.method.maxPort\=$(wt.method.bg.maxPort)

 

You need to define own variable for $(wt.manager.cmd.MethodServer)

All settings started with "$(" pointing to another line where the setting is written as a variable

 

in my case I rewrite original setting to my own one. 

 

wt.manager.cmd.BackgroundMethodServer=$(wt.manager.cmd.BGMethodServer) wt.method.serviceName\={1} wt.queue.executeQueues\=true wt.queue.queueGroup\={5} wt.intersvrcom.sitePing\=false wt.adapter.enabled\=false wt.method.minPort\=$(wt.method.bg.minPort) wt.method.maxPort\=$(wt.method.bg.maxPort)
wt.manager.cmd.BackgroundMethodServer.java.cmd.quoted=$(wt.manager.cmd.MethodServer.java.cmd.quoted)
wt.manager.cmd.BackgroundMethodServer.java.extra.args=$(wt.manager.cmd.MethodServer.java.extra.args)
wt.manager.cmd.BackgroundMethodServer.param.15=
wt.manager.cmd.BackgroundMethodServerLauncher=$(wt.manager.cmd.MethodServerLauncher)
wt.manager.cmd.BGMethodServer=$(wt.manager.cmd.BGMethodServer.java.command)
wt.manager.cmd.BGMethodServer.java.command=$(wt.java.bgmscmd.quoted) $(wt.manager.cmd.common.java.args) $(wt.manager.cmd.common.psm.agent.args.MS) -Dlog4j2.configurationFile\=WEB-INF/log4jBackgroundMethod.properties $(wt.manager.cmd.MethodServer.jmx.args) $(wt.manager.cmd.MethodServer.debug.args) {12} -Xms{14}m -Xmx{4}m $(wt.manager.cmd.MethodServer.platform.java.args) {11} wt.method.MethodServerMain

wt.java.bgmscmd.quoted=$(wt.java.bgmscmd)

wt.java.bgmscmd=C\:\\Windchill_12.0\\Java\\bin\\BackgroundSrv.exe

 

the reason of the BackgroundSrv.exe is to see this name in process explorer instead of java.exe. (BackgroundSrv.exe is just copy of java.exe)

 

)

 

PetrH

View solution in original post

4 REPLIES 4
HelesicPetr
22-Sapphire I
(To:berny2U)

Hi @berny2U 

It is normal behavior, that the log file is created for each MS process.

 

The log4J configuration file applies for all processes so this is the reason that file is created for all of them.

 

If you need to create the log file for BacgroundMethod server, you need to separate the log4J configuration for bacgroundMethod server.

 

in wt.properties find following line where cmd definition is configured for bacgroundMS process. 

 

wt.manager.cmd.BGMethodServer.java.command=$(wt.java.bgmscmd.quoted) $(wt.manager.cmd.common.java.args) $(wt.manager.cmd.common.psm.agent.args.MS) -Dlog4j2.configurationFile\=$(wt.method.log4j.config) $(wt.manager.cmd.MethodServer.jmx.args) $(wt.manager.cmd.MethodServer.debug.args) {12} -Xms{14}m -Xmx{4}m $(wt.manager.cmd.MethodServer.platform.java.args) {11} wt.method.MethodServerMain

 

rewrite the $(wt.method.log4j.config)  to your new separate log4j config file for bacgroundserver proces: example WEB-INF/log4jBackgroundMethod.properties. In that file you can define your log configuration just for BG.exe. 

My suggestion is to create ootb copy of log4jMethodServer.properties file and in the new one add your configuration

 

Also, I would say that this change you should do by xconfmanager to propagate this change correctly. 

 

PetrH 

Hi @HelesicPetr 
We are at version 12.0.2.6 and do see the commands for the background worker a bit different;

wt.manager.cmd.BackgroundMethodServer=$(wt.manager.cmd.MethodServer) wt.method.serviceName\={1} wt.queue.executeQueues\=true wt.queue.queueGroup\={5} wt.intersvrcom.sitePing\=false wt.adapter.enabled\=false wt.method.minPort\=$(wt.method.bg.minPort) wt.method.maxPort\=$(wt.method.bg.maxPort)
wt.manager.cmd.BackgroundMethodServer.java.cmd.quoted="$(wt.java.cmdBGM)"
wt.manager.cmd.BackgroundMethodServer.java.extra.args=-XX\:+DisableExplicitGC
wt.manager.cmd.BackgroundMethodServerLauncher=$(wt.manager.cmd.MethodServerLauncher)

I am not so experienced in the configuration of Windchill, can you explain what option should be set here ?

Regards
Bernard

 

HelesicPetr
22-Sapphire I
(To:berny2U)

Hi @berny2U 

I have to add that I set my background server by my own settings called BGMethodServer

This is a reason why you see different setting. 

 

The point is to set -Dlog4j2.configurationFile\=$(wt.method.log4j.config)  separately to a background method server.

This can be little bit complicated but it is possible. 

 

in your case there is a line with wt.manager.cmd.BackgroundMethodServer=$(wt.manager.cmd.MethodServer) wt.method.serviceName\={1} wt.queue.executeQueues\=true wt.queue.queueGroup\={5} wt.intersvrcom.sitePing\=false wt.adapter.enabled\=false wt.method.minPort\=$(wt.method.bg.minPort) wt.method.maxPort\=$(wt.method.bg.maxPort)

 

You need to define own variable for $(wt.manager.cmd.MethodServer)

All settings started with "$(" pointing to another line where the setting is written as a variable

 

in my case I rewrite original setting to my own one. 

 

wt.manager.cmd.BackgroundMethodServer=$(wt.manager.cmd.BGMethodServer) wt.method.serviceName\={1} wt.queue.executeQueues\=true wt.queue.queueGroup\={5} wt.intersvrcom.sitePing\=false wt.adapter.enabled\=false wt.method.minPort\=$(wt.method.bg.minPort) wt.method.maxPort\=$(wt.method.bg.maxPort)
wt.manager.cmd.BackgroundMethodServer.java.cmd.quoted=$(wt.manager.cmd.MethodServer.java.cmd.quoted)
wt.manager.cmd.BackgroundMethodServer.java.extra.args=$(wt.manager.cmd.MethodServer.java.extra.args)
wt.manager.cmd.BackgroundMethodServer.param.15=
wt.manager.cmd.BackgroundMethodServerLauncher=$(wt.manager.cmd.MethodServerLauncher)
wt.manager.cmd.BGMethodServer=$(wt.manager.cmd.BGMethodServer.java.command)
wt.manager.cmd.BGMethodServer.java.command=$(wt.java.bgmscmd.quoted) $(wt.manager.cmd.common.java.args) $(wt.manager.cmd.common.psm.agent.args.MS) -Dlog4j2.configurationFile\=WEB-INF/log4jBackgroundMethod.properties $(wt.manager.cmd.MethodServer.jmx.args) $(wt.manager.cmd.MethodServer.debug.args) {12} -Xms{14}m -Xmx{4}m $(wt.manager.cmd.MethodServer.platform.java.args) {11} wt.method.MethodServerMain

wt.java.bgmscmd.quoted=$(wt.java.bgmscmd)

wt.java.bgmscmd=C\:\\Windchill_12.0\\Java\\bin\\BackgroundSrv.exe

 

the reason of the BackgroundSrv.exe is to see this name in process explorer instead of java.exe. (BackgroundSrv.exe is just copy of java.exe)

 

)

 

PetrH

Thanks Petrh
That should be ok although i have to learn about this and apply it.
Regards
Bernard

Announcements
Top Tags