Re: Persist dynamic configuration changes to log4j.xml file
Hi, I was looking for this option too, changing log level with JMX, is it possible to share your log4j JMX config or if you know any doc can you share. Thanks for Help Gopal bjacobt wrote: Hello, I'm using Log4j 1.2.15 along with Log4j extras companion. We use the extras because I want to use RollingFileAppender and then compress the file once it is rolled over. I also need to provide an interface to dynamically change log configuration, (MaxFileSize, Number Of rolled over files (MaxIndex), and Log Level). I have a JMX MBean registered and I'm able to change configuration at runtime. Now my next step is to persist the changes made through JMX to the log4j.xml configuration file. Is there a utility already written for this purpose? Or does anyone have an easy way to achieve this. Thank you, Jacob. -- View this message in context: http://www.nabble.com/Persist-dynamic-configuration-changes-to-log4j.xml-file-tp17799896p18252684.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
MaxBackupIndex in DailyRollingFileAppender
Hi, When using a DailyRollingFileAppender, is there any way to specify the maximum number of files which should be kept? I know that the RollingFileAppender supports a maxBackupIndex property, but it seems this is not supported by DailyRollingFileAppender. I don't want to use RollingFileAppender because I want the files to rollover every day, rather than when they reach a certain size. So my requirements are: - Roll files over daily - Only keep the last 5 log files Any Solution? Regards, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
additivity attribute for logger does not diffrently for root and user-defined logger.
I have two Java classes that used log4j. curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter and curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter Both classes from above uses different class: curam.tools.upgradehelper.util.SQLStatements where a logger in each of the class with defined in following pattern: private static final Logger log = Logger.getLogger(NameOfTheClass.class); Next I have defined log4j.xml. I want to have a full log file in two separate files for both classes. curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in QuestionSequenceOrderConverterTool.log curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter in TaskRedirectionConverterTool.log I did a following: I have not defined root at all. My assumption was that if I run one of the class curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter I would got all the logs from that class and allthe classes used internaly by curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in the addQuestionSequenceOrderTool.log. Instead I got an log4j warning: log4j:WARN No appenders could be found for logger (curam.tools.upgradehelper.util.SQLStatements). What is the meaning of the attribute additivity for each logger? Why don't I get all the logs in one file? During my testing I have defined a root logger as well. but it does not do what I want. All the expected lines are present in both files but the files are populated with the log from the same class. Could anybody help me with defining a correct log4j.xml file? -- View this message in context: http://www.nabble.com/additivity-attribute-for-logger-does-not-diffrently-for-root-and-user-defined-logger.-tp18259080p18259080.html Sent from the Log4j - Users mailing list archive at Nabble.com.
additivity attribute does not work for user-defined logger but works for root logger.
I have two Java classes that used log4j. curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter and curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter Both classes from above uses different class: curam.tools.upgradehelper.util.SQLStatements where a logger in each of the class with defined in following pattern: private static final Logger log = Logger.getLogger(NameOfTheClass.class); Next I have defined log4j.xml. I want to have a full log file in two separate files for both classes. curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in QuestionSequenceOrderConverterTool.log curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter in TaskRedirectionConverterTool.log I did a following: I have not defined root at all. My assumption was that if I run one of the class curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter I would got all the logs from that class and all the classes used internally by curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in the addQuestionSequenceOrderTool.log. Instead I got an log4j warning: log4j:WARN No appenders could be found for logger (curam.tools.upgradehelper.util.SQLStatements). What is the meaning of the attribute additivity for each logger? Why don't I get all the logs in one file? During my testing I have defined a root logger as well, but it does not do what I want. All the expected lines are present in both files but the files are populated with the log from the same class. root level value=info/ appender-ref ref=taskRedirection/ appender-ref ref=addQuestionSequenceOrder/ /root I use log4j-1.2.15.jar Could anybody help me with defining a correct log4j.xml file? -- View this message in context: http://www.nabble.com/%22additivity%22-attribute-does-not-work-for-user-defined-logger-but-works-for-root-logger.-tp18259092p18259092.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: additivity attribute for logger does not diffrently for root and user-defined logger.
Camer38 skrev den 03-07-2008 15:15: Instead I got an log4j warning: log4j:WARN No appenders could be found for logger (curam.tools.upgradehelper.util.SQLStatements). This sounds like your configuration file is not picked up. Try running with -Dlog4j.debug=true to see what is happening. What is the meaning of the attribute additivity for each logger? From http://logging.apache.org/log4j/1.2/manual.html *Appender Additivity* The output of a log statement of logger /C/ will go to all the appenders in /C/ and its ancestors. This is the meaning of the term appender additivity. However, if an ancestor of logger /C/, say /P/, has the additivity flag set to |false|, then /C/'s output will be directed to all the appenders in /C/ and it's ancestors upto and including /P/ but not the appenders in any of the ancestors of /P/. Loggers have their additivity flag set to |true| by default. There is a table detailling the rules on the page. -- Thorbjørn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: additivity attribute for logger does not diffrently for root and user-defined logger.
My log file based on the log4j.xml that is picked up as expected. I still do not see the correct/full log from my tool (java class) Buildfile: addQuestionSequenceOrder.xml addQuestionSequenceOrderConverter: [java] log4j: Trying to find [log4j.xml] using context classloader [EMAIL PROTECTED] [java] log4j: Using URL [file:/C:/CURAM/CuramUpgradeHelper/bin/log4j.xml] for automatic log4j configuration. [java] log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator [java] log4j: System property is :null [java] log4j: Standard DocumentBuilderFactory search succeded. [java] log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl [java] log4j: debug attribute= true. [java] log4j: reset attribute= false. [java] log4j: Threshold =null. [java] log4j: Retreiving an instance of org.apache.log4j.Logger. [java] log4j: Setting [curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter] additivity to [true]. [java] log4j: Level value for curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter is [debug]. [java] log4j: curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter level set to DEBUG [java] log4j: Class name: [org.apache.log4j.RollingFileAppender] [java] log4j: Setting property [file] to [./logs/addQuestionSequenceOrderTool.log]. [java] log4j: Setting property [threshold] to [DEBUG]. [java] log4j: Setting property [maxFileSize] to [2000KB]. [java] log4j: Setting property [maxBackupIndex] to [10]. [java] log4j: Parsing layout of class: org.apache.log4j.PatternLayout [java] log4j: Setting property [conversionPattern] to [%d{-MM-dd-ss} [%t] %5p %c.%M(%F:%L) - %m%n]. [java] log4j: setFile called: ./logs/addQuestionSequenceOrderTool.log, true [java] log4j: setFile ended [java] log4j: Adding appender named [addQuestionSequenceOrder] to category [curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter]. [java] Using configured properties for logging. [java] Using configured properties for logging. [java] log4j:WARN No appenders could be found for logger (curam.tools.upgradehelper.util.SQLStatements). [java] log4j:WARN Please initialize the log4j system properly. [java] Connecting to Oracle data source : oracle.jdbc.pool.OracleDataSource. BUILD SUCCESSFUL Total time: 3 seconds -- View this message in context: http://www.nabble.com/additivity-attribute-for-logger-does-not-diffrently-for-root-and-user-defined-logger.-tp18259080p18259975.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: additivity attribute does not work for user-defined logger but works for root logger.
Please provide your full log4j.xml. Heri -Original Message- From: Camer38 [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 3:26 PM To: log4j-user@logging.apache.org Subject: additivity attribute does not work for user-defined logger but works for root logger. I have two Java classes that used log4j. curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter and curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter Both classes from above uses different class: curam.tools.upgradehelper.util.SQLStatements where a logger in each of the class with defined in following pattern: private static final Logger log = Logger.getLogger(NameOfTheClass.class); Next I have defined log4j.xml. I want to have a full log file in two separate files for both classes. curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in QuestionSequenceOrderConverterTool.log curam.tools.upgradehelper.taskredirection.TaskRedirectionConve rter in TaskRedirectionConverterTool.log I did a following: I have not defined root at all. My assumption was that if I run one of the class curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter I would got all the logs from that class and all the classes used internally by curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in the addQuestionSequenceOrderTool.log. Instead I got an log4j warning: log4j:WARN No appenders could be found for logger (curam.tools.upgradehelper.util.SQLStatements). What is the meaning of the attribute additivity for each logger? Why don't I get all the logs in one file? During my testing I have defined a root logger as well, but it does not do what I want. All the expected lines are present in both files but the files are populated with the log from the same class. root level value=info/ appender-ref ref=taskRedirection/ appender-ref ref=addQuestionSequenceOrder/ /root I use log4j-1.2.15.jar Could anybody help me with defining a correct log4j.xml file? -- View this message in context: http://www.nabble.com/%22additivity%22-attribute-does-not-work -for-user-defined-logger-but-works-for-root-logger.-tp18259092 p18259092.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: additivity attribute does not work for user-defined logger but works for root logger.
It is correct log4j.xml log4j:configuration debug=true xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=addQuestionSequenceOrder class=org.apache.log4j.RollingFileAppender layout class=org.apache.log4j.PatternLayout /layout /appender appender name=taskRedirection class=org.apache.log4j.RollingFileAppender layout class=org.apache.log4j.PatternLayout /layout /appender logger name=curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter additivity=true level value=debug/ appender-ref ref=addQuestionSequenceOrder/ /logger logger name=curam.tools.upgradehelper.taskredirection.TaskRedirectionConverter level value=info/ appender-ref ref=taskRedirection/ /logger /log4j:configuration -- View this message in context: http://www.nabble.com/%22additivity%22-attribute-does-not-work-for-user-defined-logger-but-works-for-root-logger.-tp18259092p18261411.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: additivity attribute does not work for user-defined logger but works for root logger.
Camer38 skrev den 03-07-2008 15:25: My assumption was that if I run one of the class curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter I would got all the logs from that class and all the classes used internally by curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter in the addQuestionSequenceOrderTool.log. No. The logger frameworks do not do magic to deduce where logging should go. If you want for classes called to use a specific logger, you must pass it as an argument like all values you want to use. Instead I got an log4j warning: log4j:WARN No appenders could be found for logger (curam.tools.upgradehelper.util.SQLStatements). You are most likely using a logger variable in SQLStatements which has been defined at the top of that class referring to SQLStatments.class. This does not allow log4j to distinguish between the two cases you have. I have the same problem in a project where it is two threads logging in the same file. I have not yet found a good solution. During my testing I have defined a root logger as well, but it does not do what I want. All the expected lines are present in both files but the files are populated with the log from the same class. root level value=info/ appender-ref ref=taskRedirection/ appender-ref ref=addQuestionSequenceOrder/ /root This say that you want all messages at info level or higher to go to both the taskRedirection appender AND the addQuestionSequenceOrder appender. -- Thorbjørn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Question for CustomSQLDBReceiver
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/log4j/db/CustomSQLDBReceiver.html Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update your chainsaw xml config file to use the receiver (see the Welcome tab - there's a 'view example receiver configuration' button on that tab which contains an example configuration file. The receiver essentially requires you to define aliases from your columns to fixed columns the receiver is going to use to run the query. It also supports an IDField param, which is assumed to be an auto-incrementing int, which will allow you to 'tail' the events from the database when running the query multiple times (if the refreshMillis param is defined). Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 9:12 AM To: log4j-user@logging.apache.org Subject: Question for CustomSQLDBReceiver Hello All, I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have got an idea of what it is, I am not able to get it running. Please provide me an internet link or URL that explains the steps to use a CustomSQLDBReceiver. Thanks in anticipation. Regards, Varun - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to apply layout to AsyncAppender?
I have a scenario where I want to use multiple appenders for the same logger (FileAppender and SocketAppender for now). Both appenders need to format the message using the same layout. Instead of formatting the single message multiple times(in the FileAppender and in the SocketAppender), I was wanting to put both of these appenders under an AsyncAppender and apply the layout once in the AsyncAppender, then send the formatted message to my sub-appenders. What is the best way to accomplish this? From what I can tell the AsyncAppender does not support layouts. Thanks, Robbie
RE: How to apply layout to AsyncAppender?
SocketAppender doesn't support a layout. log4j doesn't support the concept of inherited layouts, so you'll have to specify it for each appender that needs one. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Robbie Robinson [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 10:40 AM To: log4j-user@logging.apache.org Subject: How to apply layout to AsyncAppender? I have a scenario where I want to use multiple appenders for the same logger (FileAppender and SocketAppender for now). Both appenders need to format the message using the same layout. Instead of formatting the single message multiple times(in the FileAppender and in the SocketAppender), I was wanting to put both of these appenders under an AsyncAppender and apply the layout once in the AsyncAppender, then send the formatted message to my sub-appenders. What is the best way to accomplish this? From what I can tell the AsyncAppender does not support layouts. Thanks, Robbie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to apply layout to AsyncAppender?
I wasn't thinking so much about trying to have the layout inherited by the sub-appenders as much as apply the layout and actually format the data at the AsyncAppender level. That way I only spend the resources formatting the data once (inside the AsyncAppender) instead of multiple times, once per sub-appender. I realize the AsyncAppender does not support layouts, so I am looking for an alternative. I ultimately want to format/convert the log message into a custom XML format, but only do it once and deliver it to multiple appenders. Thanks, Robbie -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 1:42 PM To: Log4J Users List Subject: RE: How to apply layout to AsyncAppender? SocketAppender doesn't support a layout. log4j doesn't support the concept of inherited layouts, so you'll have to specify it for each appender that needs one. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Robbie Robinson [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 10:40 AM To: log4j-user@logging.apache.org Subject: How to apply layout to AsyncAppender? I have a scenario where I want to use multiple appenders for the same logger (FileAppender and SocketAppender for now). Both appenders need to format the message using the same layout. Instead of formatting the single message multiple times(in the FileAppender and in the SocketAppender), I was wanting to put both of these appenders under an AsyncAppender and apply the layout once in the AsyncAppender, then send the formatted message to my sub-appenders. What is the best way to accomplish this? From what I can tell the AsyncAppender does not support layouts. Thanks, Robbie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Question for CustomSQLDBReceiver
I created a table with the following statement. 1) CREATE TABLE `userdb`.`sys_log` ( `log_id` int(10) unsigned NOT NULL auto_increment, `log_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `sys_name` varchar(45) NOT NULL, `machine_name` varchar(45) NOT NULL, `class_name` varchar(45) NOT NULL, `priority` varchar(45) NOT NULL, `message` varchar(45) default NULL, `extended_message` varchar(45) default NULL, `user_id` int(10) unsigned NOT NULL, `method_name` varchar(45) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; My config file is like this... 2) ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=A2 class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.SimpleLayout/ /appender plugin name=CustomDBReceiver class=org.apache.log4j.db.CustomSQLDBReceiver connectionSource class=org.apache.log4j.db.DriverManagerConnectionSource param name=password value=admin/ param name=user value=root/ param name=driverClass value=org.gjt.mm.mysql.Driver/ param name=url value=jdbc:mysql://127.0.0.1/user_db/ /connectionSource param name=refreshMillis value=5000/ param name=sql value='select logger as LOGGER, log_date as TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS, method_name as METHOD, concat({{application,databaselogs,hostname,mymachine,log4jid,, COUNTER, }}) as PROPERTIES, as EXCEPTION from sys_log'/ THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE param name=IDField value=log_id/ /plugin root level value=debug/ /root /log4j:configuration I also setup automatic configuration script to point to my config file in chainsaw. But when I open chainsaw, nothing happens. I have also put the MySQL driver .jar file in .chainsaw/plugins directory. Please let me know what I am missing. Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 10:29 AM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/ log4j/db/CustomSQLDBReceiver.html Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update your chainsaw xml config file to use the receiver (see the Welcome tab - there's a 'view example receiver configuration' button on that tab which contains an example configuration file. The receiver essentially requires you to define aliases from your columns to fixed columns the receiver is going to use to run the query. It also supports an IDField param, which is assumed to be an auto-incrementing int, which will allow you to 'tail' the events from the database when running the query multiple times (if the refreshMillis param is defined). Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 9:12 AM To: log4j-user@logging.apache.org Subject: Question for CustomSQLDBReceiver Hello All, I am new to Chainsaw and want to use CustomSQLDBReceiver. Though I have got an idea of what it is, I am not able to get it running. Please provide me an internet link or URL that explains the steps to use a CustomSQLDBReceiver. Thanks in anticipation. Regards, Varun
RE: Question for CustomSQLDBReceiver
How to use CustomSQLDBReceiver: 1. create a $userhome/.chainsaw/plugins folder 2. copy your jdbc driver to the plugins folder 3. the Chainsaw downloads page links to an 'inportant distribution notes' link for more info about extended features - go there and follow the instructions for what you're trying to do (db extensions) 4. create a chainsaw xml config file containing a customsqldbreceiver section 4a. make sure to follow the directions in the class javadoc for the receiver for setting up the 'sql' param (read: all fields must be aliased!!) 5. change Chainsaw's 'automatic configuration url' to the URL of the chainsaw xml config file (view-show application wide preferences menu) 7. you may need to check the 'ok to remove security manager' checkbox as well (on the same prefs screen) 8. restart Chainsaw You should have a receiver defined in the receivers panel. If you don't, you haven't got the URL entered correctly in the application-wide prefs screen, or the chainsaw XML config isn't defining the receiver configuration correctly (see an example of a receiver config on the Welcome tab's 'view example receiver configuration' button). If you can't figure this out, turn on your java console, pre-configuration Chainsaw logging goes there. If you don't get a new tab containing your db's events, examine Chainsaw's own logging in the chainsaw-log tab - it should explain what the problem is. If you still have problems, feel free to email the list. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 12:44 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver I created a table with the following statement. 1) CREATE TABLE `userdb`.`sys_log` ( `log_id` int(10) unsigned NOT NULL auto_increment, `log_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `sys_name` varchar(45) NOT NULL, `machine_name` varchar(45) NOT NULL, `class_name` varchar(45) NOT NULL, `priority` varchar(45) NOT NULL, `message` varchar(45) default NULL, `extended_message` varchar(45) default NULL, `user_id` int(10) unsigned NOT NULL, `method_name` varchar(45) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; My config file is like this... 2) ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=A2 class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.SimpleLayout/ /appender plugin name=CustomDBReceiver class=org.apache.log4j.db.CustomSQLDBReceiver connectionSource class=org.apache.log4j.db.DriverManagerConnectionSource param name=password value=admin/ param name=user value=root/ param name=driverClass value=org.gjt.mm.mysql.Driver/ param name=url value=jdbc:mysql://127.0.0.1/user_db/ /connectionSource param name=refreshMillis value=5000/ param name=sql value='select logger as LOGGER, log_date as TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS, method_name as METHOD, concat({{application,databaselogs,hostname,mymachine,log4jid,, COUNTER, }}) as PROPERTIES, as EXCEPTION from sys_log'/ THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE param name=IDField value=log_id/ /plugin root level value=debug/ /root /log4j:configuration I also setup automatic configuration script to point to my config file in chainsaw. But when I open chainsaw, nothing happens. I have also put the MySQL driver .jar file in .chainsaw/plugins directory. Please let me know what I am missing. Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 10:29 AM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/ log4j/db/CustomSQLDBReceiver.html Add your jdbc jar to the $userhome/.chainsaw/plugins folder and update your chainsaw xml config file to use the receiver (see the Welcome tab - there's a 'view example receiver configuration' button on that tab which contains an example configuration file. The receiver essentially requires you to define aliases from your columns to fixed columns the receiver is going to use to run the query. It also
RE: Question for CustomSQLDBReceiver
Hello, I believe I am doing all of the steps mentioned below. I think the issue is with the configuration file where I have the SQL. In CustomSQLDBReceiver, there is an example query select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS, method as METHOD, file as FILE, line as LINE, concat({{application,databaselogs,hostname,mymachine, log4jid,, COUNTER,}}) as PROPERTIES, as THROWABLE from logtable I have 1 question in the above statement. 1) Do I need to have all the columns as part of table? Right now my table structure is not having following columns THREAD,NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE (If these columns are required, what should be their respective data types). Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 1:51 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver How to use CustomSQLDBReceiver: 1. create a $userhome/.chainsaw/plugins folder 2. copy your jdbc driver to the plugins folder 3. the Chainsaw downloads page links to an 'inportant distribution notes' link for more info about extended features - go there and follow the instructions for what you're trying to do (db extensions) 4. create a chainsaw xml config file containing a customsqldbreceiver section 4a. make sure to follow the directions in the class javadoc for the receiver for setting up the 'sql' param (read: all fields must be aliased!!) 5. change Chainsaw's 'automatic configuration url' to the URL of the chainsaw xml config file (view-show application wide preferences menu) 7. you may need to check the 'ok to remove security manager' checkbox as well (on the same prefs screen) 8. restart Chainsaw You should have a receiver defined in the receivers panel. If you don't, you haven't got the URL entered correctly in the application-wide prefs screen, or the chainsaw XML config isn't defining the receiver configuration correctly (see an example of a receiver config on the Welcome tab's 'view example receiver configuration' button). If you can't figure this out, turn on your java console, pre-configuration Chainsaw logging goes there. If you don't get a new tab containing your db's events, examine Chainsaw's own logging in the chainsaw-log tab - it should explain what the problem is. If you still have problems, feel free to email the list. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 12:44 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver I created a table with the following statement. 1) CREATE TABLE `userdb`.`sys_log` ( `log_id` int(10) unsigned NOT NULL auto_increment, `log_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `sys_name` varchar(45) NOT NULL, `machine_name` varchar(45) NOT NULL, `class_name` varchar(45) NOT NULL, `priority` varchar(45) NOT NULL, `message` varchar(45) default NULL, `extended_message` varchar(45) default NULL, `user_id` int(10) unsigned NOT NULL, `method_name` varchar(45) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; My config file is like this... 2) ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=A2 class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.SimpleLayout/ /appender plugin name=CustomDBReceiver class=org.apache.log4j.db.CustomSQLDBReceiver connectionSource class=org.apache.log4j.db.DriverManagerConnectionSource param name=password value=admin/ param name=user value=root/ param name=driverClass value=org.gjt.mm.mysql.Driver/ param name=url value=jdbc:mysql://127.0.0.1/user_db/ /connectionSource param name=refreshMillis value=5000/ param name=sql value='select logger as LOGGER, log_date as TIMESTAMP, priority as LEVEL, message as MESSAGE, class_name as CLASS, method_name as METHOD, concat({{application,databaselogs,hostname,mymachine,log4jid,, COUNTER, }}) as PROPERTIES, as EXCEPTION from sys_log'/ THREAD, NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE param name=IDField value=log_id/ /plugin root level value=debug/ /root /log4j:configuration I also setup
RE: Question for CustomSQLDBReceiver
The receiver needs all of the columns to be in the result set that it's creating events from. You DO NOT need to have all of the columns in your schema - you just need to make sure the resultset being built contains the columns. You do this by using aliases to rename or add missing columns, and specifying default values if the column is missing Examples: If you have a column named THREAD, just include THREAD as one of the columns being selected if you don't have column representing the THREAD information in your table, use: as THREAD If you have a column representing thread information, but isn't named THREAD, use: myThreadColumnName as THREAD Hope that clarifies. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 1:09 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver Hello, I believe I am doing all of the steps mentioned below. I think the issue is with the configuration file where I have the SQL. In CustomSQLDBReceiver, there is an example query select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS, method as METHOD, file as FILE, line as LINE, concat({{application,databaselogs,hostname,mymachine, log4jid,, COUNTER,}}) as PROPERTIES, as THROWABLE from logtable I have 1 question in the above statement. 1) Do I need to have all the columns as part of table? Right now my table structure is not having following columns THREAD,NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE (If these columns are required, what should be their respective data types). Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 1:51 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver How to use CustomSQLDBReceiver: 1. create a $userhome/.chainsaw/plugins folder 2. copy your jdbc driver to the plugins folder 3. the Chainsaw downloads page links to an 'inportant distribution notes' link for more info about extended features - go there and follow the instructions for what you're trying to do (db extensions) 4. create a chainsaw xml config file containing a customsqldbreceiver section 4a. make sure to follow the directions in the class javadoc for the receiver for setting up the 'sql' param (read: all fields must be aliased!!) 5. change Chainsaw's 'automatic configuration url' to the URL of the chainsaw xml config file (view-show application wide preferences menu) 7. you may need to check the 'ok to remove security manager' checkbox as well (on the same prefs screen) 8. restart Chainsaw You should have a receiver defined in the receivers panel. If you don't, you haven't got the URL entered correctly in the application-wide prefs screen, or the chainsaw XML config isn't defining the receiver configuration correctly (see an example of a receiver config on the Welcome tab's 'view example receiver configuration' button). If you can't figure this out, turn on your java console, pre-configuration Chainsaw logging goes there. If you don't get a new tab containing your db's events, examine Chainsaw's own logging in the chainsaw-log tab - it should explain what the problem is. If you still have problems, feel free to email the list. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 12:44 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver I created a table with the following statement. 1) CREATE TABLE `userdb`.`sys_log` ( `log_id` int(10) unsigned NOT NULL auto_increment, `log_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `sys_name` varchar(45) NOT NULL, `machine_name` varchar(45) NOT NULL, `class_name` varchar(45) NOT NULL, `priority` varchar(45) NOT NULL, `message` varchar(45) default NULL, `extended_message` varchar(45) default NULL, `user_id` int(10) unsigned NOT NULL, `method_name` varchar(45) NOT NULL, PRIMARY KEY (`log_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; My config file is like this... 2) ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=true appender name=A2
RE: Question for CustomSQLDBReceiver
Thanks a ton Scott, it worked. The problem was that few columns were missing in the SQL statement, everything else was fine. Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 2:45 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver The receiver needs all of the columns to be in the result set that it's creating events from. You DO NOT need to have all of the columns in your schema - you just need to make sure the resultset being built contains the columns. You do this by using aliases to rename or add missing columns, and specifying default values if the column is missing Examples: If you have a column named THREAD, just include THREAD as one of the columns being selected if you don't have column representing the THREAD information in your table, use: as THREAD If you have a column representing thread information, but isn't named THREAD, use: myThreadColumnName as THREAD Hope that clarifies. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 1:09 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver Hello, I believe I am doing all of the steps mentioned below. I think the issue is with the configuration file where I have the SQL. In CustomSQLDBReceiver, there is an example query select logger as LOGGER, timestamp as TIMESTAMP, level as LEVEL, thread as THREAD, message as MESSAGE, ndc as NDC, mdc as MDC, class as CLASS, method as METHOD, file as FILE, line as LINE, concat({{application,databaselogs,hostname,mymachine, log4jid,, COUNTER,}}) as PROPERTIES, as THROWABLE from logtable I have 1 question in the above statement. 1) Do I need to have all the columns as part of table? Right now my table structure is not having following columns THREAD,NDC, MDC, FILE, LINE, PROPERTIES, THROWABLE (If these columns are required, what should be their respective data types). Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814 -Original Message- From: Scott Deboy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 1:51 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver How to use CustomSQLDBReceiver: 1. create a $userhome/.chainsaw/plugins folder 2. copy your jdbc driver to the plugins folder 3. the Chainsaw downloads page links to an 'inportant distribution notes' link for more info about extended features - go there and follow the instructions for what you're trying to do (db extensions) 4. create a chainsaw xml config file containing a customsqldbreceiver section 4a. make sure to follow the directions in the class javadoc for the receiver for setting up the 'sql' param (read: all fields must be aliased!!) 5. change Chainsaw's 'automatic configuration url' to the URL of the chainsaw xml config file (view-show application wide preferences menu) 7. you may need to check the 'ok to remove security manager' checkbox as well (on the same prefs screen) 8. restart Chainsaw You should have a receiver defined in the receivers panel. If you don't, you haven't got the URL entered correctly in the application-wide prefs screen, or the chainsaw XML config isn't defining the receiver configuration correctly (see an example of a receiver config on the Welcome tab's 'view example receiver configuration' button). If you can't figure this out, turn on your java console, pre-configuration Chainsaw logging goes there. If you don't get a new tab containing your db's events, examine Chainsaw's own logging in the chainsaw-log tab - it should explain what the problem is. If you still have problems, feel free to email the list. Scott Deboy COMOTIV SYSTEMS 111 SW Columbia Street Ste. 950 Portland, OR 97201 Telephone: 503.224.7496 Cell: 503.997.1367 Fax:503.222.0185 [EMAIL PROTECTED] www.comotivsystems.com -Original Message- From: Rally, Varun [mailto:[EMAIL PROTECTED] Sent: Thu 7/3/2008 12:44 PM To: Log4J Users List Subject: RE: Question for CustomSQLDBReceiver I created a table with the following statement. 1) CREATE TABLE `userdb`.`sys_log` ( `log_id` int(10) unsigned NOT NULL auto_increment, `log_date` timestamp NOT NULL default CURRENT_TIMESTAMP, `sys_name` varchar(45) NOT NULL, `machine_name` varchar(45) NOT NULL, `class_name`
Chainsaw SMTP Receiver.
Hello, As we have different custom receivers in Chainsaw. Since we have SMTP Appender available in Log4J. Do we have corresponding SMTPReceiver for chainsaw to read auto-generated mails from mailbox and display them? Regards, Varun Rally --- Fiserv, A-94/8, SECTOR 58 NOIDA UP INDIA 201301 Phone- 91-120-4023000 extn. 3268 Cell- 91-98990-37800 VOIP - 434-509-0698 Extn. 121 US Phone- 001-303-293-2223 Extn. 22814
Re: additivity attribute does not work for user-defined logger but works for root logger.
My answers below... Why the root logger defined: root level value=debug/ appender-ref ref=taskRedirection/ appender-ref ref=addQuestionSequenceOrder/ /root knows that all the logs from ALL the classes should go the the file specified by appenders:taskRedirection, addQuestionSequenceOrder That's the way it's supposed to work, root logger gets everything unless you configure it not to. and a logger: logger name=curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter additivity=true level value=debug/ appender-ref ref=addQuestionSequenceOrder/ /logger knows that ONLY logs from that class curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter has to be served? That's the way that is supposed to work, too. You can get less specific and get all classes in a package hierarchy to log to a logger. Example: logger name=curam.tools.upgradehelper ... If not, why this parameter additivity=true is present at all? It does nothing. additivity is true by default, so you are correct that setting additivity=true doesn't change the behavior. There is an excellent description of how additivity works in log4j short manual http://logging.apache.org/log4j/1.2/manual.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using HTMLLayout with DailyRollingFileAppender
HI All, I have a requirement in one of my prjects that the log files be generated in HTML format and that they should automatically be rolled over everyday. For thi purpose, I am trying to use HTMLLayout with DailyRollingFileAppender. However, the file is not rolled over. Instead, the log information is only appended in the old file itself. Is there any other way in which I can achive the same?? The code I have written for the same is as follows: Final Logger log = Logger..getLogger(xyz.class); String strDatePattern = '.'MMdd; HTMLLayout layout = new HTMLLayout(); String filename = test.html; DailyRollingFileAppender appender = new DailyRollingFileAppender (layout, filename, strDatePattern); appender.activateOptions(); log.info(My Message Goes Here); Is there anything that I am missing out upon? Or is there some other way how I can achieve the same? An early help would be appreciated. Thanks and Regards Rajat Aggarwal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]