Omit xml part
Hello, i send some binary data in xml messages with my webservices.. I log all communication for debugging purposes. The problem is the binary value gets logged as well making the log very big.. I want to log the rest of the xml but just not the one field/property containing the binary data.. can i configure Log4j to just not log that line/property of the xml message? Regards Alexander - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
What is the reason you want extend the Logger? Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Thursday, October 21, 2010 1:22 PM To: log4j-user@logging.apache.org Subject: Extending Logger The complete Log4J manual discourages us from extending Logger but we use the recommended pattern then 'repository' and 'getEffectiveLevel()' are inaccessible because they are protected in Category. public void trace(Object message) { if (repository.isDisabled(Level.TRACE_INT)) { return; } if (Level.TRACE.isGreaterOrEqual(this.getEffectiveLevel())) { forcedLog(FQCN, Level.TRACE, message, null); } } Can we extend Logger ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30018462.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
I wanted to associate the logger file with each Logger instead of the Appender. I have a setFile/getFile in the Logger that I plan to call using my custom Appender so that the log message is written to the file associated with the Logger. Reasons : 1. We have two many appender sections in the XML because there are too many log files. 2. I want to use my custom logger/appender and another xml file - not log4j.xml - to associate a logger with a file. I am trying to parse and read the file name from my custom XML file and set it in my custom logger that log4j's repository has. -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113301.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
If I understand you correctly: You have many instances of your CustomLogger (as many as you want different log files), each wrapping a separate instance of Logger. The name of the file is configured in a file (I assume a pairing of logger names and file names?). My suggestion: Do not extend Logger, but instantiate the Loggers programmatically and supply it with a FileAppender which is also instantiatted programmatically (based on your config file). Heri BTW: The extending of Logger is discouraged not because it would not work (well, some particular features wouldn't work anymore), but because one cannot imagine any reason why this would be necessary. The work of Log4j is done within the Appenders, Filters, Layouts, etc. The Logger class only provides an entry point for log statements in code. -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Tuesday, November 02, 2010 1:26 PM To: log4j-user@logging.apache.org Subject: RE: Extending Logger I wanted to associate the logger file with each Logger instead of the Appender. I have a setFile/getFile in the Logger that I plan to call using my custom Appender so that the log message is written to the file associated with the Logger. Reasons : 1. We have two many appender sections in the XML because there are too many log files. 2. I want to use my custom logger/appender and another xml file - not log4j.xml - to associate a logger with a file. I am trying to parse and read the file name from my custom XML file and set it in my custom logger that log4j's repository has. -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113301.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
So this is what I understand. If I have too many appender sections in the XML then one appender for a logger is created by log4j. Instead of that I can have one appender and a custom logger for each log file. Both could be equivalent as far as performance is concerned. Am I right ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113734.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
I am confused. Do you respond to my suggestion? I suggested to set up everything Logger and Appender) programmatically, as it is defined in your own config file. Which performance do you mean? The setup performance or the runtime, when the loggers are used? The latter is independantly of how you set up your logger univers, the former should not concern, or does it? Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Tuesday, November 02, 2010 2:26 PM To: log4j-user@logging.apache.org Subject: RE: Extending Logger So this is what I understand. If I have too many appender sections in the XML then one appender for a logger is created by log4j. Instead of that I can have one appender and a custom logger for each log file. Both could be equivalent as far as performance is concerned. Am I right ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113734.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
Yes. I am responding to your suggestion. The setup performance is not very important. The runtime performance though is. If I setup everything programmatically log4j.xml is not at all needed ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113852.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Extending Logger
I don't know. You have to try if the log4j.xml can be omitted. Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Tuesday, November 02, 2010 2:39 PM To: log4j-user@logging.apache.org Subject: RE: Extending Logger Yes. I am responding to your suggestion. The setup performance is not very important. The runtime performance though is. If I setup everything programmatically log4j.xml is not at all needed ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113852.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Extending Logger
I would tend to have a minimal log4j.xml containing basic configuration for the root logger, which I usually set to WARN to avoid being bombarded with annoying messages from libraries I don't care about. However, there is no necessity to have a log4j.xml (or log4j.properties). Log4j can be configured via config file or programmatically (or both), but if Log4j can't find any config file, it will say as much in System.err, which I generally try to avoid. All the other stuff can be configured programmatically as Bender suggested. Jake On Tue, 2 Nov 2010 14:46:52 +0100 Bender Heri hben...@ergonomics.ch wrote: I don't know. You have to try if the log4j.xml can be omitted. Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Tuesday, November 02, 2010 2:39 PM To: log4j-user@logging.apache.org Subject: RE: Extending Logger Yes. I am responding to your suggestion. The setup performance is not very important. The runtime performance though is. If I setup everything programmatically log4j.xml is not at all needed ? -- View this message in context: http://old.nabble.com/Extending-Logger-tp30018462p30113852.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Omit xml part
Den 02/11/10 10.25, Alexander Curvers skrev: Hello, i send some binary data in xml messages with my webservices.. I log all communication for debugging purposes. The problem is the binary value gets logged as well making the log very big.. I want to log the rest of the xml but just not the one field/property containing the binary data.. can i configure Log4j to just not log that line/property of the xml message? Not immediately, but you can use the XSLT implementation available in the Java Runtime to remove the binary value from your XML before logging it. -- Thorbjørn Ravn Andersen ...plus... Tubular Bells! - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org