Bug 534397 (RHQ-1198)

Summary: be able to change agent's log4j config on the fly at runtime
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: AgentAssignee: John Mazzitelli <mazz>
Status: CLOSED NEXTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedKeywords: Improvement
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-1198
Whiteboard:
Fixed In Version: 1.2 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Mazzitelli 2008-12-01 06:22:00 UTC
this came out of a discussion from agent auto-upgrade, RHQ-110 - it would be nice to switch the agent's log4j.xml at runtime (hot deploy) so we can turn on and off debug messages without recycling the agent.  also would be nice to turn on and off command tracing as well (which is just 2 specific log4j categories to set)

Comment 1 John Mazzitelli 2008-12-01 06:39:47 UTC
syntax: debug [--file=<log4j filename>] [--comm=true|false]

you can now turn on debug messages and command tracing while the agent is running, and turn it off while its running without shutting down agent.

Comment 2 Corey Welton 2008-12-22 16:05:19 UTC
Should user be able to impl. a new logfile instance via this method?  For example, the following exercise seems to fail.

> debug --file=/root/foo.txt
Cannot load log file [/root/foo.txt]. Cause: java.io.FileNotFoundException:/root/foo.txt

In this case, there was no prior file, "/root/foo.txt".  Of course, touching said file and reattempting the above step results in a traceback about the file being non log4j compliant.

Perhaps we could initiate a new log4j file if the requested location does not exist?  A few ideas...

> debug --file=/root/foo.txt
Cannot load log file [/root/foo.txt]. This file does not exist.  Create it?

> debug --file=/root/foo.txt
Cannot load log file [/root/foo.txt]. This file does not exist.  To create, use 'debug --new'


Similar actions could take place for a non-compliant file -- perhaps simply an indication that this file is not log4j compliant, versus a full traceback...

> debug --file=/root/foo.txt
Cannot load log file [/root/foo.txt]. This does not appear to be a log4j compliant logfile.

Both of these scenarios should probably be separate jiras however.


Comment 3 Corey Welton 2008-12-22 16:54:29 UTC
Most of above comment can be ignored.  It was due (in part)  to some ambiguous terminology in "debug --help".

Otherwise, this appears to work fine.

Comment 4 John Mazzitelli 2008-12-22 17:04:52 UTC
I fixed the help info on the debug command to make it clear --file defines the log4j.xml configuration file - its not an output file where the logs go.

> help debug
Syntax: debug [--file=<conf>] [--comm=true|false] [--threaddump]

Provides features to help debug the agent.
-c|--comm=true|false: enables or disables server-agent communications trace.
-f|--file=<conf>: reconfigures the logging system with the given file.
                  <conf> can be 'log4j.xml', 'log4j-debug.xml',
                  'log4j-warn.xml' or any file found in /conf.
                  You can even use your own log configuration file by
                  placing it in the /conf directory.
-t|--threaddump: dumps the stacks for all threads in the agent VM.

Comment 5 Red Hat Bugzilla 2009-11-10 20:27:53 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1198
This bug incorporates RHQ-1108