From log4j-dev-angelaoliver@example.org Mon Dec 01 07:09:15 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 79397 invoked from network); 1 Dec 2008 07:09:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Dec 2008 07:09:15 -0000 Received: (qmail 6739 invoked by uid 500); 1 Dec 2008 07:09:20 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 6596 invoked by uid 500); 1 Dec 2008 07:09:20 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 6564 invoked by uid 500); 1 Dec 2008 07:09:19 -0000 Received: (qmail 6559 invoked by uid 99); 1 Dec 2008 07:09:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 30 Nov 2008 23:09:19 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO brutus.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 07:07:59 +0000 Received: by brutus.apache.org (Postfix, from userid 1007) id 368C9234C2AB; Sun, 30 Nov 2008 23:08:17 -0800 (PST) From: angelaoliver@example.org To: angelaoliver@example.org Subject: Bug report for Log4j [2008/11/30] Message-Id: <angelaoliver@example.org> Date: Sun, 30 Nov 2008 23:08:15 -0800 (PST) X-Virus-Checked: Checked by ClamAV on apache.org +---------------------------------------------------------------------------+ | Bugzilla Bug ID | | +---------------------------------------------------------------------+ | | Status: UNC=Unconfirmed NEW=New ASS=Assigned | | | OPN=Reopened VER=Verified (Skipped Closed/Resolved) | | | +-----------------------------------------------------------------+ | | | Severity: BLK=Blocker CRI=Critical REG=Regression MAJ=Major | | | | MIN=Minor NOR=Normal ENH=Enhancement TRV=Trivial | | | | +-------------------------------------------------------------+ | | | | Date Posted | | | | | +--------------------------------------------------+ | | | | | Description | | | | | | | |13099|Opn|Nor|2002-09-27|DOMConfigurator ignores category factory setting | |17887|Opn|Maj|2003-03-11|RollingFileAppender does not work for 10 threads | |20395|Inf|Enh|2003-06-01|PreparedStatementAppender Enhancement | |23329|Ass|Enh|2003-09-22|<logger> element in XML config should support reso| |26084|Inf|Nor|2004-01-13|Log Event detail panel does not show special chara| |27363|Inf|Enh|2004-03-02|JNI based SyslogAppender | |27367|Inf|Enh|2004-03-02|NetSendAppender | |28647|Ass|Enh|2004-04-28|Add "Flush on Level" capability to FileAppender | |29244|Inf|Nor|2004-05-27|Preserve XML content in log messages when using XM| |29304|New|Nor|2004-05-30|Starting XMLSocketAppender from config file | |29305|New|Nor|2004-05-30|Chainsaw doesn't see locationinfo from XMLSocketRe| |29735|New|Nor|2004-06-22|Receiver list display error when receiver has no | |30055|New|Nor|2004-07-12|Problem with registering Appenders with the same n| |30407|Inf|Maj|2004-07-30|Externally rolled file problem | |30888|New|Maj|2004-08-27|Chainsaw mixes files in same panel | |30890|New|Min|2004-08-27|Newly opened log file should get focus | |30892|New|Min|2004-08-27|Log files cannot be closed | |31089|New|Nor|2004-09-07|Does not accept ISO8601 dates in focus field | |31178|Inf|Cri|2004-09-11|Exception using Chainsaw for simple debugging | |31179|Ass|Enh|2004-09-11|Implement Chainsaw as Eclipse stand-alone applicat| |33278|New|Min|2005-01-27|NPE thrown durring daily log file rollover | |33493|Inf|Enh|2005-02-10|contribution to log4j: servlet diagnostic context | |33717|New|Nor|2005-02-23|Leaving out %throwable in ConversionPattern adds t| |34440|New|Nor|2005-04-13|sandbox:IMAppender - comma-seperated recipient lis| |34491|Ver|Nor|2005-04-18|Missing include in build.jms target results in mis| |34651|New|Enh|2005-04-27|allow for a header on top of every rolled file | |34738|New|Nor|2005-05-04|Chainsaw does not remember what Columns are select| |34945|Inf|Nor|2005-05-17|ThrowableInformation has dubious Stack Trace extra| |34974|Inf|Cri|2005-05-19|Exception when running a Pluglet | |35180|New|Min|2005-06-02|Multiple lines "XML files (*.xml)" in drop down li| |35239|Inf|Nor|2005-06-06|NullPointerException when saving displayed events | |35563|Inf|Enh|2005-06-30|Syslog appender parametrability | |35996|Inf|Enh|2005-08-03|Add support for ant-like <property> in log4j.xml | |36435|New|Enh|2005-08-31|Log4J RollingFileAppender under OpenVMS does not f| |36654|Inf|Min|2005-09-14|Provide better error messages for "Please initiali| |36789|Inf|Nor|2005-09-23|Empty control flow statement in org.apache.log4j.l| |36860|New|Enh|2005-09-29|[jmx] Add ability to create a logger MBean for a n| |37349|Ass|Nor|2005-11-03|DBAppender not working with jTDS driver | |37638|New|Nor|2005-11-25|logging doesn't fall back with FallbackErrorHandle| |37734|Inf|Nor|2005-12-01|Customize Event ID and Event Category with NTEVent| |37762|Ass|Enh|2005-12-02|RSSAppender or other approach. | |38061|New|Nor|2005-12-28|Problem configuring an errorHandler using a proper| |38363|Ass|Nor|2006-01-24|SecurityException during log output | |38394|Ver|Enh|2006-01-26|PropertySetter fails to print stacktrace if error | |38395|Ver|Reg|2006-01-26|Unable to set threshold on appender via config fil| |38406|Ver|Nor|2006-01-26|jdk1.4 dependencies in log4j 1.3 alpha | |38513|New|Nor|2006-02-05|[PATCH] Suggested unit test for JMSAppender | |38582|Ass|Nor|2006-02-08|Chainsaw does not include Receiver JavaDoc in dist| |38590|Inf|Nor|2006-02-09|no space on device fails another instance | |38883|Opn|Nor|2006-03-07|LogFilePatternReceiver fails to process multi-line| |38884|New|Nor|2006-03-07|null pointer exception displaying logs if number o| |39690|Inf|Cri|2006-05-31|Initialization fail in J2EE Environment | |39691|Ass|Nor|2006-05-31|DBAppender doesn't log long events | |40068|New|Nor|2006-07-18|Add support for attach-on-demand API to chainsaw | |40124|New|Min|2006-07-27|startup (JWS) does not initialize ignored elements| |40251|Opn|Min|2006-08-14|Hard coded JMX domain name for MBean instances | |40382|Inf|Maj|2006-09-01|Sysappender hangs during boot time on HP | |40385|Inf|Maj|2006-09-01|SocketServer cannot find config file when passed a| |40472|New|Nor|2006-09-11|SettingsManager calls loadSettings with global set| |40533|New|Nor|2006-09-18|Chainsaw not showing all logging statements | |40570|Inf|Blk|2006-09-21|RollingFileAppender does not rollover when the fil| |40611|New|Trv|2006-09-27|Bad subclass example; NullPointerException in Logg| |40736|Inf|Nor|2006-10-11|log4j delete permission denied | |40889|Inf|Nor|2006-11-03|repeated entries in log after failure | |40990|Inf|Nor|2006-11-17|Cannot bind port or ip address for outgoing UDP so| |41006|Inf|Enh|2006-11-20|Contributing XMLSocketHubReceiver | |41214|Ass|Maj|2006-12-19|Deadlock with RollingFileAppender | |41311|Inf|Min|2007-01-06|Please make TimeBasedRollingPolicy non-final? | |41316|New|Nor|2007-01-08|NPE when using RollingFileAppender in Tomcat. | |41547|Inf|Nor|2007-02-05|PropertyConfigurator and layout.contentType | |41799|New|Enh|2007-03-09|SyslogAppender should enable to customize Log4j.Le| |41882|Inf|Nor|2007-03-18|IE7 problems with Log4J web site | |41937|New|Nor|2007-03-23|Logs from some panels missing in custom expression| |41980|Inf|Maj|2007-03-29|Log4j stop updating log file- version log4j-1.2.8 | |42171|New|Nor|2007-04-19|SocketHubReceiver duplicates messages | |42189|Ass|Nor|2007-04-22|Add simple bridge for java.util.logging, with basi| |42213|Opn|Blk|2007-04-24|log4j causing threads to stuck in weblogic | |42516|Inf|Nor|2007-05-24|Log4j failed to log file when packaged in Eclipse | |42664|New|Enh|2007-06-14|JUL Appender | |42842|Opn|Nor|2007-07-09|Create a PUBLIC identifier for the log4j DTD | |42883|Opn|Nor|2007-07-12|'Welcome' and 'Drag & Drop' panels can't be hidden| |42933|Inf|Maj|2007-07-18|IllegalStateException thrown from FileAppender.clo| |43061|Opn|Enh|2007-08-08|Flush appender regularty | |43148|Ass|Nor|2007-08-16|LogFilePatternReceiver depends on jakarta-oro, cou| |43277|New|Nor|2007-08-31|Add LogMF.entering, .exiting and .throwing methods| |43282|Ass|Nor|2007-08-31|Add OSGi packaging info to log4j and companions | |43313|Inf|Nor|2007-09-05|log4j 1.2.16 release considerations and discussion| |43403|Inf|Nor|2007-09-16|PatternLayout: new format modifer: prefix if non-e| |43619|New|Enh|2007-10-13|Simple proposal for pluggable sys-props resolvers | |43637|Inf|Nor|2007-10-16|SocketAppender.append(LoggingEvent) calls the Erro| |43728|Inf|Cri|2007-10-29|Log file loss when specified file is locked by ano| |43736|Ass|Nor|2007-10-30|Chainsaw does not honor encoding when loading XML | |43820|New|Enh|2007-11-08|[PATCH] Layered Configurator Patch | |43879|Inf|Nor|2007-11-16|FileAppender writes Header multiple times | |43911|Inf|Nor|2007-11-20|logfiles not getting rolled over with RollingFileA| |43923|Inf|Min|2007-11-21|JBOSS specific information in javadocs | |44038|Inf|Cri|2007-12-07|log4j is susceptible to exceptions thrown by Excep| |44219|Inf|Nor|2008-01-13|'WARNING' for a log level is silently ignored/chan| |44308|Inf|Enh|2008-01-28|[Patch] JMX component for managing Logger configur| |44357|New|Enh|2008-02-05|List of property keys | |44370|Inf|Reg|2008-02-06|MANIFEST.MF broken in log4j-1.2.15.jar | |44386|Opn|Nor|2008-02-10|NTEventLogAppender.dll for windows 64 | |44526|Inf|Nor|2008-03-04|segmentation fault occuring when PropertyConfigura| |44557|Inf|Nor|2008-03-07|no close call to Appender after replacing the root| |44649|Inf|Nor|2008-03-20|JMS Hangs when a Root Appender | |44700|Inf|Nor|2008-03-28|Log4J locks rolled log files | |44727|Inf|Nor|2008-04-01|Add missing Logger#isErrorEnabled and isWarningEna| |44834|Inf|Nor|2008-04-17|SimpleSocketServer looses buffered logs, produces | |44839|Inf|Nor|2008-04-17|SyslogAppender logging to a UNIX domain socket | |44932|New|Enh|2008-05-05|improve DailyRollingFileAppender handling of rotat| |44934|Inf|Enh|2008-05-05|add helper method to DailyRollingFileAppender to g| |44945|New|Nor|2008-05-06|SyslogAppender not working | |45029|Ass|Nor|2008-05-18|Additional unit tests for Filters in extras compan| |45042|New|Nor|2008-05-19|Need a reliable way to detect misconfiguration | |45068|New|Enh|2008-05-22|Ability to copy contents from log-entries | |45109|Inf|Nor|2008-05-31|SMTPAppender uses wrong property for mail server | |45165|Ass|Enh|2008-06-09|Multifile Appender | |45224|Inf|Nor|2008-06-17|Log 4j giving nullpointer when reloading applicat| |45231|Inf|Nor|2008-06-18|Clear appenders call on logger calls a helper whic| |45236|Inf|Cri|2008-06-19|Wriring output to an out-dated file. | |45304|New|Nor|2008-06-29|using log4j with OAS for some reasone all the logg| |45305|Inf|Nor|2008-06-29|using log4j with OAS for some reasone all the logg| |45375|New|Enh|2008-07-10|Building log4j core without manually installing li| |45481|New|Trv|2008-07-25|Source contains unused imports | |45482|Inf|Min|2008-07-25|Source contains unused variables | |45493|New|Maj|2008-07-28|Log4j file getting overwritten | |45629|New|Nor|2008-08-13|TopicConnection is not closed | |45660|New|Enh|2008-08-20|NDC could remove Hashtable entry if Stack gets emp| |45704|New|Maj|2008-08-28|Failed to load logging.xml for JRE 1.5.0_16 and We| |45753|New|Nor|2008-09-06|Code contribution | |45781|New|Nor|2008-09-11|RollingFileAppender under Windows does not rotate | |45782|New|Enh|2008-09-11|Add a new appender that zip's rolled files | |45855|New|Enh|2008-09-21|Add site/apt documentation for JULBridgeLogManager| |45915|New|Cri|2008-09-30|DeadLock occured in AsyncAppender | |45932|New|Nor|2008-10-01|Log4j JMX MBeans not cleaned up | |45934|New|Enh|2008-10-02|FileAppender should use virtual-machine shutdown h| |45939|New|Nor|2008-10-02|Cannot drop HierarchyDynamicMBean from LoggerRepos| |45941|Inf|Enh|2008-10-03|Custom PatternLayout | |46046|New|Nor|2008-10-20|Date conversion in PatternLayout does not follow c| |46049|New|Enh|2008-10-21|Filter support in PropertyConfigurator | |46100|New|Enh|2008-10-27|NagiosAppender available for contribution | |46129|Ass|Nor|2008-10-30|Thread name is not logged correctly when using asy| |46144|New|Nor|2008-11-04|QuietWriter.write should ignore all Exceptions | |46163|New|Nor|2008-11-06|LoggerDynamicMBean needs to handle a null Appender| |46226|New|Min|2008-11-18|log4j.properties not using the right log level | |46260|New|Nor|2008-11-21|RollingFileAppender and Tomcat has a strange behav| |46271|New|Nor|2008-11-23|NullPointException from SyslogAppender | +-----+---+---+----------+--------------------------------------------------+ | Total 147 bugs | +---------------------------------------------------------------------------+ --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org From log4j-dev-angelaoliver@example.org Mon Dec 01 08:42:12 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 13750 invoked from network); 1 Dec 2008 08:42:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Dec 2008 08:42:10 -0000 Received: (qmail 91169 invoked by uid 500); 1 Dec 2008 08:42:21 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 91141 invoked by uid 500); 1 Dec 2008 08:42:21 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 91130 invoked by uid 99); 1 Dec 2008 08:42:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 00:42:21 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO brutus.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 08:41:02 +0000 Received: by brutus.apache.org (Postfix, from userid 33) id 294E8234C297; Mon, 1 Dec 2008 00:41:18 -0800 (PST) From: angelaoliver@example.org To: angelaoliver@example.org Subject: DO NOT REPLY [Bug 41214] Deadlock with RollingFileAppender X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: newchanged X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Log4j X-Bugzilla-Component: Appender X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: angelaoliver@example.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: angelaoliver@example.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC In-Reply-To: <angelaoliver@example.org/bugzilla/> References: <angelaoliver@example.org/bugzilla/> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Message-Id: <angelaoliver@example.org> Date: Mon, 1 Dec 2008 00:41:18 -0800 (PST) X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=41214 Deepak <angelaoliver@example.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |angelaoliver@example.org --- Comment #25 from Deepak <angelaoliver@example.org> 2008-12-01 00:41:17 PST --- The problem is pretty consistent and seems to be happening on high traffic servers. Here is one that I caught on my weblogic server. This lock will eventually bring the server down since the request processor / servlet engines will be unable to process any further requests. I am not sure about the lock scalability thing. My logs indicate a positive deadlock condition. Is this going to be fixed anytime soon ? java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) BEA JRockit(R) (build R26.4.0-63_CR302700-72606-1.5.0_06-20061127-1108-win-ia32, ) OS - Windows 2000 SP4 Log4j version - 1.2.15 Server - Weblogic 10 SP1 Deadlocks encountered on a web application built on Struts 1.1 Circular (deadlocked) lock chains ================================= Chain 2: ================================= "[STUCK] ExecuteThread: '39' for queue: 'weblogic.kernel.Default (self-tuning)'" id=11799 idx=0xee tid=6520 waiting for org/apache/log4j/Logger@0x05AE0EF0 held by: "[STUCK] ExecuteThread: '28' for queue: 'weblogic.kernel.Default (self-tuning)'" id=6044 idx=0x9c tid=6496 waiting for org/apache/log4j/RollingFileAppender@0x0B1E4CB8 held by: "[STUCK] ExecuteThread: '39' for queue: 'weblogic.kernel.Default (self-tuning)'" id=11799 idx=0xee tid=6520 ================================= Thread 39 ================================= "[STUCK] ExecuteThread: '39' for queue: 'weblogic.kernel.Default (self-tuning)'" id=11799 idx=0xee tid=6520 prio=1 alive, in native, blocked, daemon -- Blocked trying to get lock: org/apache/log4j/Logger@0x05AE0EF0[thin lock] at jrockit/vm/Threads.sleep(I)V(Native Method) at jrockit/vm/Locks.waitForThinRelease(Ljava/lang/Object;I)I(Unknown Source) at jrockit/vm/Locks.monitorEnterSecondStage(Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source) at jrockit/vm/Locks.monitorEnter(Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source) at org/apache/log4j/Category.callAppenders(Lorg/apache/log4j/spi/LoggingEvent;)V(Category.java:201) at org/apache/log4j/Category.forcedLog(Ljava/lang/String;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V(Category.java:388) at org/apache/log4j/Category.debug(Ljava/lang/Object;)V(Category.java:257) ================================= Thread 28 ================================= "[STUCK] ExecuteThread: '28' for queue: 'weblogic.kernel.Default (self-tuning)'" id=6044 idx=0x9c tid=6496 prio=1 alive, in native, blocked, daemon -- Blocked trying to get lock: org/apache/log4j/RollingFileAppender@0x0B1E4CB8[thin lock] at jrockit/vm/Threads.sleep(I)V(Native Method) at jrockit/vm/Locks.waitForThinRelease(Ljava/lang/Object;I)I(Unknown Source) at jrockit/vm/Locks.monitorEnterSecondStage(Ljava/lang/Object;I)Ljava/lang/Object;(Unknown Source) at jrockit/vm/Locks.monitorEnter(Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source) at org/apache/log4j/AppenderSkeleton.doAppend(Lorg/apache/log4j/spi/LoggingEvent;)V(AppenderSkeleton.java:210) at org/apache/log4j/helpers/AppenderAttachableImpl.appendLoopOnAppenders(Lorg/apache/log4j/spi/LoggingEvent;)I(AppenderAttachableImpl.java:65) at org/apache/log4j/Category.callAppenders(Lorg/apache/log4j/spi/LoggingEvent;)V(Category.java:203) ^-- Holding lock: org/apache/log4j/Logger@0x05AE0EF0[thin lock] at org/apache/log4j/Category.forcedLog(Ljava/lang/String;Lorg/apache/log4j/Priority;Ljava/lang/Object;Ljava/lang/Throwable;)V(Category.java:388) at org/apache/log4j/Category.debug(Ljava/lang/Object;)V(Category.java:257) -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org From log4j-dev-angelaoliver@example.org Mon Dec 01 10:38:27 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 73145 invoked from network); 1 Dec 2008 10:38:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 1 Dec 2008 10:38:26 -0000 Received: (qmail 19251 invoked by uid 500); 1 Dec 2008 10:38:38 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 19231 invoked by uid 500); 1 Dec 2008 10:38:37 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 19220 invoked by uid 99); 1 Dec 2008 10:38:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 02:38:37 -0800 X-ASF-Spam-Status: No, hits=2.4 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of angelaoliver@example.org designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO wf-out-1314.google.com) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2008 10:37:06 +0000 Received: by wf-out-1314.google.com with SMTP id 24so2638483wfg.7 for <angelaoliver@example.org>; Mon, 01 Dec 2008 02:37:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=lQTuJSIYkQoUyk2HlMoU+M9FCkyyOBAa9a41rzrO2bI=; b=uEqeTR0KhG4K8qdoR4B/M/AdqK9CRU1HhALXyrLo3tJafqB7qUpNHuxx6Mqml9p9Ze QF0HCLgsBxfPU1zkSuN3J3YhxBNPdSaWgy5tqGQz+tPBNnw1wRDAJ97MUsrWqjo2ygG+ 6kFPPTC2OznrB3WDcNSMdJU+kFmE/eFkZ8Iso= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=GCzA23r3XC/PS04Ah07ir9hcVciQ92klG0Q2lt1Cngabsga54Pd4Trjd0rqyGbyX1Z +D2VvJKRf2IrGm0pJMBB3xEdEMOznvK0BRbEaHvl8XRqpMBg1RO8og0YM4tZNTdYrwcI BBSwsRbPbxxGucUeWOj8/kvkO5AiyZzMWFVVM= Received: by 83.161.120.155 with SMTP id q19mr4460499wfq.187.1228127873409; Mon, 01 Dec 2008 02:37:53 -0800 (PST) Received: by 83.161.120.155 with HTTP; Mon, 1 Dec 2008 02:37:53 -0800 (PST) Message-ID: <angelaoliver@example.org> Date: Mon, 1 Dec 2008 16:07:53 +0530 From: "Vaibhav Kumar" <angelaoliver@example.org> To: "Log4J Developers List" <angelaoliver@example.org> Subject: Re: CLOB column datatype for JDBCPlus jdbc appender In-Reply-To: <angelaoliver@example.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_68737_2688655.1228127873401" References: <angelaoliver@example.org> <angelaoliver@example.org> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_68737_2688655.1228127873401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Ece, For CLOB usage, you would have to modify log4j.xml by using the prepared statement approach. Also you would have to use MDC in your logger class. eg. in log4j.xml <appender name="JDBC" class="org.apache.log4j.jdbcplus.JDBCAppender"> <param name="url" value="jdbc:oracle:thin:@localhost:1521:XE"/> <param name="dbclass" value="oracle.jdbc.OracleDriver" /> <param name="username" value="system" /> <param name="password" value="welcome1" /> <param name="connector" value="edu.unc.its.util.MyOracleConnectionHandler" /> <param name="table" value="error_log" /> <param name="column" value="id~ORACLE_SEQUENCE~error_log_seq" /> <param name="column" value="process_id~MDC~ProcessId" /> <param name="column" value="process_name~MDC~ProcessName" /> <param name="column" value="message_id~MDC~MessageId" /> <param name="column" value="transaction_id~MDC~TransactionId" /> <param name="column" value="instance_id~MDC~InstanceId" /> <param name="column" value="source_system~MDC~SourceSystem" /> <param name="column" value="target_system~MDC~TargetSystem" /> <param name="column" value="error_log_level~MDC~ErrorLogLevel" /> <param name="column" value="attribute1~MDC~Attribute1" /> <param name="column" value="attribute2~MDC~Attribute2" /> <param name="column" value="attribute3~MDC~Attribute3" /> <param name="column" value="attribute4~MDC~Attribute4" /> <param name="column" value="attribute5~MDC~Attribute5" /> <param name="column" value="error_message~MDC~ErrorMessage" /> <param name="column" value="row_mod_dt~MDC~RowModifyDate" /> <param name="column" value="row_create_dt~MDC~RowCreateDate" /> <param name="column" value="message_timestamp~MDC~MessageTimestamp" /> <param name="usePreparedStatements" value="true" /> <param name="usePreparedStatements" value="true" /> <filter class="org.apache.log4j.varia.LevelRangeFilter"> <param name="LevelMin" value="error" /> <param name="LevelMax" value="fatal" /> </filter> </appender> In logger class code snippet can be: MDC.put(MESSAGE_TIMESTAMP, getMessageDate(date_time)); MDC.put(PROCESS_ID, process_id); MDC.put(PROCESS_NAME, process_name); MDC.put(MESSAGE_ID, message_id); MDC.put(TRANSACTION_ID, transaction_id); MDC.put(INSTANCE_ID, instance_id); MDC.put(SOURCE_SYSTEM, source); MDC.put(TARGET_SYSTEM, target); MDC.put(ERROR_LOG_LEVEL, service_level); MDC.put(ERROR_MESSAGE, message); MDC.put(ROW_MODIFY_DATE, formatter.format(new Date())); MDC.put(ROW_CREATE_DATE, formatter.format(new Date())); subsequently removal also: MDC.remove(PROCESS_ID); MDC.remove(PROCESS_NAME); MDC.remove(MESSAGE_TIMESTAMP); MDC.remove(MESSAGE_ID); MDC.remove(TRANSACTION_ID); MDC.remove(INSTANCE_ID); MDC.remove(SOURCE_SYSTEM); MDC.remove(TARGET_SYSTEM); MDC.remove(ERROR_LOG_LEVEL); MDC.remove(ERROR_MESSAGE); MDC.remove(ROW_MODIFY_DATE); MDC.remove(ROW_CREATE_DATE); Thanks & Regards, Vaibhav On Tue, Nov 25, 2008 at 8:34 PM, Ece Yildirim <angelaoliver@example.org> wrote: > > Hi Vaibhav, > > I am suffering of the same error. Could you find a solution regarding this > problem ? I checked org.apache.log4j.jdbcplus.JDBCLogger class, there seems > to be no explicit implementation for CLOB data type. > > Thank you > Ece > > > > > Vaibhav Kumar wrote: > > > > Hi, > > I am using JDBCPlus (http://www.dankomannhaupt.de/projects/index.html ) > as > > a > > jdbc appender for my application. For a particular requirement, I have to > > make a column datatype from varchar2(4000) to CLOB. But as soon as I do > > this, my application fails to log in database giving stack trace as > > > > log4j:ERROR JDBCAppender888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4lush_buffer(), : > > java.sql.SQLException: Internal Error: Unable to construct a Datum from > > the > > specified input > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168) > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210) > > at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829) > > at oracle.sql.SQLUtil.makeDatum(SQLUtil.java:645) > > at oracle.sql.SQLUtil.makeOracleDatum(SQLUtil.java:946) > > at > > > oracle.jdbc.driver.UpdatableResultSet.updateObject(UpdatableResultSet.java:1568) > > at > > > oracle.jdbc.driver.OracleResultSet.updateObject(OracleResultSet.java:2787) > > at org.apache.log4j.jdbcplus.JDBCLogger.append(JDBCLogger.java:742) > > at > > > org.apache.log4j.jdbcplus.JDBCAppender.flush_buffer(JDBCAppender.java:887) > > at > org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:867) > > at > > org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) > > at > > > org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) > > at org.apache.log4j.Category.callAppenders(Category.java:203) > > at org.apache.log4j.Category.forcedLog(Category.java:388) > > at org.apache.log4j.Category.log(Category.java:853) > > at edu.unc.its.util.UNCLogger.prepareAndLogMessage(UNCLogger.java:445) > > at edu.unc.its.util.UNCLoggerClient.main(UNCLoggerClient.java:23) > > log4j:ERROR JDBCAppender888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4lush_buffer(), : > > java.sql.SQLException: Internal Error: Unable to construct a Datum from > > the > > specified input > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168) > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210) > > at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829) > > at oracle.sql.SQLUtil.makeDatum(SQLUtil.java:645) > > at oracle.sql.SQLUtil.makeOracleDatum(SQLUtil.java:946) > > at > > > oracle.jdbc.driver.UpdatableResultSet.updateObject(UpdatableResultSet.java:1568) > > at > > > oracle.jdbc.driver.OracleResultSet.updateObject(OracleResultSet.java:2787) > > at org.apache.log4j.jdbcplus.JDBCLogger.append(JDBCLogger.java:742) > > at > > > org.apache.log4j.jdbcplus.JDBCAppender.flush_buffer(JDBCAppender.java:887) > > at > org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:867) > > at > > org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230) > > at > > > org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65) > > at org.apache.log4j.Category.callAppenders(Category.java:203) > > at org.apache.log4j.Category.forcedLog(Category.java:388) > > at org.apache.log4j.Category.log(Category.java:853) > > at edu.unc.its.util.UNCLogger.prepareAndLogMessage(UNCLogger.java:445) > > at edu.unc.its.util.UNCLoggerClient.main(UNCLoggerClient.java:23) > > > > > > Any suggestions as to how can I incorporate a CLOB datatype in JDBCPlus > > jdbc > > appender will be most welcome. > > > > Regards, > > Vaibhav > > > > > > -- > View this message in context: > http://www.nabble.com/CLOB-column-datatype-for-JDBCPlus-jdbc-appender-tp19306835p20682090.html > Sent from the Log4j - Dev mailing list angelaoliver@example.org. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: angelaoliver@example.org > For additional commands, e-mail: angelaoliver@example.org > > ------=_Part_68737_2688655.1228127873401 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Ece,<br>For CLOB usage, you would have to modify log4j.xml by using the prepared statement approach. Also you would have to use MDC in your logger class.<br>eg. in log4j.xml<br><br>&lt;appender name=&quot;JDBC&quot; class=&quot;org.apache.log4j.jdbcplus.JDBCAppender&quot;&gt;<br> <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;url&quot; value=&quot;jdbc:oracle:thin:@localhost:1521:XE&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;dbclass&quot; value=&quot;oracle.jdbc.OracleDriver&quot; /&gt; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;username&quot; value=&quot;system&quot; /&gt; <br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;password&quot; value=&quot;welcome1&quot; /&gt; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;connector&quot; value=&quot;edu.unc.its.util.MyOracleConnectionHandler&quot; /&gt; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;table&quot; value=&quot;error_log&quot; /&gt; <br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;id~ORACLE_SEQUENCE~error_log_seq&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;process_id~MDC~ProcessId&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;process_name~MDC~ProcessName&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;message_id~MDC~MessageId&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;transaction_id~MDC~TransactionId&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;instance_id~MDC~InstanceId&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;source_system~MDC~SourceSystem&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;target_system~MDC~TargetSystem&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;error_log_level~MDC~ErrorLogLevel&quot; /&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;attribute1~MDC~Attribute1&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;attribute2~MDC~Attribute2&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;attribute3~MDC~Attribute3&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;attribute4~MDC~Attribute4&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;attribute5~MDC~Attribute5&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;error_message~MDC~ErrorMessage&quot; /&gt;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;row_mod_dt~MDC~RowModifyDate&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;row_create_dt~MDC~RowCreateDate&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;column&quot; value=&quot;message_timestamp~MDC~MessageTimestamp&quot; /&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;param name=&quot;usePreparedStatements&quot; value=&quot;true&quot; /&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &lt;param name=&quot;usePreparedStatements&quot; value=&quot;true&quot; /&gt; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&lt;filter class=&quot;org.apache.log4j.varia.LevelRangeFilter&quot;&gt;<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;LevelMin&quot; value=&quot;error&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;param name=&quot;LevelMax&quot; value=&quot;fatal&quot; /&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/filter&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/appender&gt;<br><br>In logger class code snippet can be:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(MESSAGE_TIMESTAMP, getMessageDate(date_time));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(PROCESS_ID, process_id);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(PROCESS_NAME, process_name);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(MESSAGE_ID, message_id);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(TRANSACTION_ID, transaction_id);<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(INSTANCE_ID, instance_id);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(SOURCE_SYSTEM, source);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(TARGET_SYSTEM, target);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(ERROR_LOG_LEVEL, service_level);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(ERROR_MESSAGE, message);<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(ROW_MODIFY_DATE, formatter.format(new Date()));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.put(ROW_CREATE_DATE, formatter.format(new Date()));<br><br>subsequently removal also:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(PROCESS_ID);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(PROCESS_NAME);<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(MESSAGE_TIMESTAMP);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(MESSAGE_ID);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(TRANSACTION_ID);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(INSTANCE_ID);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(SOURCE_SYSTEM);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(TARGET_SYSTEM);<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(ERROR_LOG_LEVEL);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(ERROR_MESSAGE);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(ROW_MODIFY_DATE);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MDC.remove(ROW_CREATE_DATE);<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br>Thanks &amp; Regards,<br>Vaibhav<br><br><br><div class="gmail_quote"> On Tue, Nov 25, 2008 at 8:34 PM, Ece Yildirim <span dir="ltr">&lt;<a href="mailto:angelaoliver@example.org">angelaoliver@example.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <br> Hi Vaibhav,<br> <br> I am suffering of the same error. Could you find a solution regarding this<br> problem ? I checked org.apache.log4j.jdbcplus.JDBCLogger class, there seems<br> to be no explicit implementation for CLOB data type.<br> <br> Thank you<br> Ece<br> <div><div></div><div class="Wj3C7c"><br> <br> <br> <br> Vaibhav Kumar wrote:<br> &gt;<br> &gt; Hi,<br> &gt; I am using JDBCPlus (<a href="http://www.dankomannhaupt.de/projects/index.html" target="_blank">http://www.dankomannhaupt.de/projects/index.html</a> ) as<br> &gt; a<br> &gt; jdbc appender for my application. For a particular requirement, I have to<br> &gt; make a column datatype from varchar2(4000) to CLOB. But as soon as I do<br> &gt; this, my application fails to log in database giving stack trace as<br> &gt;<br> &gt; log4j:ERROR JDBCAppender888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4lush_buffer(), :<br> &gt; java.sql.SQLException: Internal Error: Unable to construct a Datum from<br> &gt; the<br> &gt; specified input<br> &gt; &nbsp; &nbsp;at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)<br> &gt; &nbsp; &nbsp;at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)<br> &gt; &nbsp; &nbsp;at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829)<br> &gt; &nbsp; &nbsp;at oracle.sql.SQLUtil.makeDatum(SQLUtil.java:645)<br> &gt; &nbsp; &nbsp;at oracle.sql.SQLUtil.makeOracleDatum(SQLUtil.java:946)<br> &gt; &nbsp; &nbsp;at<br> &gt; oracle.jdbc.driver.UpdatableResultSet.updateObject(UpdatableResultSet.java:1568)<br> &gt; &nbsp; &nbsp;at<br> &gt; oracle.jdbc.driver.OracleResultSet.updateObject(OracleResultSet.java:2787)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.jdbcplus.JDBCLogger.append(JDBCLogger.java:742)<br> &gt; &nbsp; &nbsp;at<br> &gt; org.apache.log4j.jdbcplus.JDBCAppender.flush_buffer(JDBCAppender.java:887)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:867)<br> &gt; &nbsp; &nbsp;at<br> &gt; org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)<br> &gt; &nbsp; &nbsp;at<br> &gt; org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.Category.callAppenders(Category.java:203)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.Category.forcedLog(Category.java:388)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.Category.log(Category.java:853)<br> &gt; &nbsp; &nbsp;at edu.unc.its.util.UNCLogger.prepareAndLogMessage(UNCLogger.java:445)<br> &gt; &nbsp; &nbsp;at edu.unc.its.util.UNCLoggerClient.main(UNCLoggerClient.java:23)<br> &gt; log4j:ERROR JDBCAppender888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4lush_buffer(), :<br> &gt; java.sql.SQLException: Internal Error: Unable to construct a Datum from<br> &gt; the<br> &gt; specified input<br> &gt; &nbsp; &nbsp;at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)<br> &gt; &nbsp; &nbsp;at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)<br> &gt; &nbsp; &nbsp;at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829)<br> &gt; &nbsp; &nbsp;at oracle.sql.SQLUtil.makeDatum(SQLUtil.java:645)<br> &gt; &nbsp; &nbsp;at oracle.sql.SQLUtil.makeOracleDatum(SQLUtil.java:946)<br> &gt; &nbsp; &nbsp;at<br> &gt; oracle.jdbc.driver.UpdatableResultSet.updateObject(UpdatableResultSet.java:1568)<br> &gt; &nbsp; &nbsp;at<br> &gt; oracle.jdbc.driver.OracleResultSet.updateObject(OracleResultSet.java:2787)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.jdbcplus.JDBCLogger.append(JDBCLogger.java:742)<br> &gt; &nbsp; &nbsp;at<br> &gt; org.apache.log4j.jdbcplus.JDBCAppender.flush_buffer(JDBCAppender.java:887)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:867)<br> &gt; &nbsp; &nbsp;at<br> &gt; org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)<br> &gt; &nbsp; &nbsp;at<br> &gt; org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.Category.callAppenders(Category.java:203)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.Category.forcedLog(Category.java:388)<br> &gt; &nbsp; &nbsp;at org.apache.log4j.Category.log(Category.java:853)<br> &gt; &nbsp; &nbsp;at edu.unc.its.util.UNCLogger.prepareAndLogMessage(UNCLogger.java:445)<br> &gt; &nbsp; &nbsp;at edu.unc.its.util.UNCLoggerClient.main(UNCLoggerClient.java:23)<br> &gt;<br> &gt;<br> &gt; Any suggestions as to how can I incorporate a CLOB datatype in JDBCPlus<br> &gt; jdbc<br> &gt; appender will be most welcome.<br> &gt;<br> &gt; Regards,<br> &gt; Vaibhav<br> &gt;<br> &gt;<br> <br> </div></div><font color="#888888">--<br> View this message in context: <a href="http://www.nabble.com/CLOB-column-datatype-for-JDBCPlus-jdbc-appender-tp19306835p20682090.html" target="_blank">http://www.nabble.com/CLOB-column-datatype-for-JDBCPlus-jdbc-appender-tp19306835p20682090.html</a><br> Sent from the Log4j - Dev mailing list angelaoliver@example.org.<br> <br> <br> ---------------------------------------------------------------------<br> To unsubscribe, e-mail: <a href="mailto:angelaoliver@example.org">angelaoliver@example.org</a><br> For additional commands, e-mail: <a href="mailto:angelaoliver@example.org">angelaoliver@example.org</a><br> <br> </font></blockquote></div><br> ------=_Part_68737_2688655.1228127873401-- From log4j-dev-angelaoliver@example.org Tue Dec 02 18:02:42 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 92993 invoked from network); 2 Dec 2008 18:02:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 2 Dec 2008 18:02:42 -0000 Received: (qmail 86317 invoked by uid 500); 2 Dec 2008 18:02:53 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 86272 invoked by uid 500); 2 Dec 2008 18:02:53 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 86261 invoked by uid 99); 2 Dec 2008 18:02:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Dec 2008 10:02:53 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO brutus.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Dec 2008 18:01:24 +0000 Received: by brutus.apache.org (Postfix, from userid 33) id ACCD9234C298; Tue, 2 Dec 2008 10:02:11 -0800 (PST) From: angelaoliver@example.org To: angelaoliver@example.org Subject: DO NOT REPLY [Bug 46324] New: SocketNode does not close socket when ending X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: newchanged X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Log4j X-Bugzilla-Component: Appender X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: angelaoliver@example.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: angelaoliver@example.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: <{{EMAIL+PHONE}}/bugzilla/> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 2 Dec 2008 10:02:11 -0800 (PST) X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=46324 Summary: SocketNode does not close socket when ending Product: Log4j Version: 1.2 Platform: PC OS/Version: Windows XP Status: NEW Severity: major Priority: P2 Component: Appender AssignedTo: angelaoliver@example.org ReportedBy: angelaoliver@example.org In org.apache.log4j.net.SocketNode, the code does not close the socket when the objectinputstream has an error. This block attempts to close the objectinputstream: try { ois.close(); } catch(Exception e) { logger.info("Could not close connection.", e); } if the objectinputstream is null, however, socket.close() is never called thus leaking a socket. Pls add try { socket.close(); } catch(Exception e) { logger.info("Could not close socket.", e); } to the end of run() in org.apache.log4j.net.SocketNode -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org From log4j-dev-angelaoliver@example.org Wed Dec 03 11:41:26 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 9728 invoked from network); 3 Dec 2008 11:41:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Dec 2008 11:41:26 -0000 Received: (qmail 15245 invoked by uid 500); 3 Dec 2008 11:41:38 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 15036 invoked by uid 500); 3 Dec 2008 11:41:37 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 15025 invoked by uid 99); 3 Dec 2008 11:41:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 03:41:36 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of angelaoliver@example.org designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO mail.qos.ch) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 11:40:07 +0000 Received: by mail.qos.ch (Postfix, from userid 1006) id 8D4FA1696F7; Wed, 3 Dec 2008 12:48:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.4-gr0 (2008-01-01) on torino X-Spam-Level: Received: from [83.161.120.155] (unknown [83.161.120.155]) by mail.qos.ch (Postfix) with ESMTP id 4E1F5169680 for <angelaoliver@example.org>; Wed, 3 Dec 2008 12:48:39 +0100 (CET) Message-ID: <angelaoliver@example.org> Date: Wed, 03 Dec 2008 12:41:00 +0100 From: Ceki Gulcu <angelaoliver@example.org> User-Agent: Thunderbird 83.161.120.155 (Windows/20081105) MIME-Version: 1.0 To: angelaoliver@example.org Subject: [PROPOSAL] Implementing the SLF4J API directly Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-4.4 required=5.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.4-gr0 Hello, As you are probably aware, more and more projects are adopting the SLF4J API. I would venture say that SLF4J's adoption rate is roughly equivalent to that of log4j itself. Although the SLF4J API is not perfect, most SLF4J users seem to be extremely happy with it. Harry Metske synthesized various logging paths in JSPWiki https://issues.apache.org/jira/secure/attachment/12394188/jspwiki-log.odp I was taken aback by the picture he paints. I think we as log4j committers owe it to Java developers to propose a saner logging model. Given the multiplicity of logging APIs in the Java world, I propose that log4j implement the SLF4J API directly. This can be done in the next version of log4j, say 1.3 or 2.0. Unfortunately, the adoption of the SLF4J API by log4j will be break 100% compatibility with existing log4j clients. More precisely, logging statements passing java.lang.Object as the message parameter will need to be changed to java.lang.String. Assuming that the proportion of logging statements using objects instead string is extremely small, comparatively few users will be affected. More importantly, in my experience, even very large projects can be migrated to the SLF4J API within half an hour. There is even a tool called slf4j-migrator to help with such migration [1]. Is there support for my proposal? [1] http://www.slf4j.org/migrator.html -- Ceki Gülcü --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org From log4j-dev-angelaoliver@example.org Wed Dec 03 13:38:26 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 85779 invoked from network); 3 Dec 2008 13:38:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Dec 2008 13:38:25 -0000 Received: (qmail 67657 invoked by uid 500); 3 Dec 2008 13:38:36 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 67635 invoked by uid 500); 3 Dec 2008 13:38:36 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 67622 invoked by uid 99); 3 Dec 2008 13:38:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 05:38:36 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of angelaoliver@example.org designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO hm784.locaweb.com.br) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 03 Dec 2008 13:37:07 +0000 Received: (qmail 27508 invoked from network); 3 Dec 2008 13:37:06 -0000 Received: from unknown (83.161.120.155) by hm784.locaweb.com.br with QMQP; 3 Dec 2008 13:37:06 -0000 Received: from unknown (HELO DIRERodrigues) (angelaoliver@example.org@83.161.120.155) by hm939.locaweb.com.br with SMTP; 3 Dec 2008 13:37:05 -0000 Reply-To: <angelaoliver@example.org> From: "Eduardo Arantes Rodrigues" <angelaoliver@example.org> To: <angelaoliver@example.org> Subject: runtime configurable file name appender Date: Wed, 3 Dec 2008 11:37:02 -0200 Organization: =?us-ascii?Q?Trigger_Solucoes?= Message-ID: <angelaoliver@example.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0025_01C9553B.75E8C3F0" X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AclVQuL7pGNTESJWTEOymxLTZN005AACU37Q X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPart_000_0025_01C9553B.75E8C3F0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0026_01C9553B.75E8C3F0" ------=_NextPart_001_0026_01C9553B.75E8C3F0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I had a specific requirement that a certain set of similar Jobs should be logged one individual file per Job. That would make things easier to troubleshooting. With the current FileAppenders implementation it would require a new appender and category for each Job. Since, so far, we have already 20 jobs it would be really painful to add and maintain all of them and also the Jobs can be dynamically added to the system. That would break the rule of having one file per Jobs. I've researched but I couldn't find an appender where the name of the file to log could be configured dynamically. Given this requirements my idea was provide a way to use PatternLayout like file names. This code allow the fileName to be defined as: "c:/temp/server[%-5p].log" Depending on the pattern a new file can be generated by class, category or even by day, hour, ... I've used the FileAppender code as base I've provide the JavaDoc for the most important methods. I hope it's useful and can be added to the project Regards, Eduardo ------=_NextPart_001_0026_01C9553B.75E8C3F0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.6000.16735" name=3DGENERATOR></HEAD> <BODY> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2>Hi,</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>I had = a specific=20 requirement that a certain set of similar Jobs should be logged one = individual=20 file per Job.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>That = would make=20 things easier to troubleshooting.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>With = the current=20 FileAppenders implementation it would require a new appender and = category for=20 each Job.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>Since, = so far, we=20 have already 20 jobs it would be really painful to add and maintain all = of them=20 and also the Jobs can be dynamically added to the = system.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>That = would break the=20 rule of having one file per Jobs.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>I've = researched but=20 I couldn't find an appender where the name of the file to log could be=20 configured dynamically.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>Given = this=20 requirements my idea was provide a way to use PatternLayout like file=20 names.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>This = code allow the=20 fileName to be defined as: = "c:/temp/server[%-5p].log"</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial = size=3D2>Depending on the=20 pattern a new file can be generated by class, category or even by day, = hour,=20 ...</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>I've = used the=20 FileAppender code as base</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>I've = provide the=20 JavaDoc for the most important methods.</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial size=3D2>I hope = it's useful=20 and can be added to the project</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008></SPAN><SPAN=20 class=3D483421512-03122008></SPAN><SPAN class=3D483421512-03122008><FONT = face=3DArial=20 size=3D2></FONT></SPAN>&nbsp;</DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2>Regards,</FONT></SPAN></DIV> <DIV><SPAN class=3D483421512-03122008><FONT face=3DArial=20 size=3D2>Eduardo</FONT></SPAN></DIV></BODY></HTML> ------=_NextPart_001_0026_01C9553B.75E8C3F0-- ------=_NextPart_000_0025_01C9553B.75E8C3F0 Content-Type: application/octet-stream; name="ConfigurableFileNameAppender.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ConfigurableFileNameAppender.java" package com.trgs; /*=20 * Copyright 1999,2004 The Apache Software Foundation. *=20 * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *=20 * http://www.apache.org/licenses/LICENSE-2.0 *=20 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or = implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import org.apache.log4j.AppenderSkeleton; import org.apache.log4j.Layout; import org.apache.log4j.PatternLayout; import org.apache.log4j.RollingFileAppender; import org.apache.log4j.helpers.LogLog; import org.apache.log4j.helpers.QuietWriter; import org.apache.log4j.spi.ErrorHandler; import org.apache.log4j.spi.LoggingEvent; /** * VariableNameAppender extends {@link AppenderSkeleton } so that the = underlying * file is rolled over at a user chosen frequency. *=20 * <p> * The variable name is specified by the <b>File</b> option. This value = should * follow the {@link PatternLayout} conventions. In particular, you * <em>must</em> escape literal text within a pair of single quotes. A = formatted * version of the fileName pattern is used as the file name. *=20 * <p> * For example, if the <b>File</b> option is set to * <code>/log/server[%c].log</code> the file * <code>/foo/bar[com.foo.ClassName].log</code> will be generated to * com.foo.ClassName class and the file * <code>/foo/bar[com.foo.AnotherClassName].log</code> will be generated = to * com.foo.AnotherClassName class. *=20 * <p> * It is possible to specify any pattern available in the {@link = PatternLayout} * class. *=20 * <p> * If you specify a data parameter the VariableNameFileAppender will = behave like * a RollingAppender creating a new file depending on the provided = parameter * <p> * For example /foo/log[%d{dd-MMM-yyyy}].log will create a new file = every day. *=20 *=20 * <p> * Is is possible to specify monthly, weekly, half-daily, daily, hourly, = or * minutely rollover schedules. *=20 *=20 * <p> * Do not use the colon ":" character in anywhere in the = <b>DatePattern</b> * option. The text before the colon is interpreted as the protocol * specification of a URL which is probably not what you want. *=20 * @author Eduardo Rodrigues */ public class ConfigurableFileNameAppender extends AppenderSkeleton { private PatternLayout fileNamePatternLayout; private Map<String, QuietWriter> qwMap =3D new HashMap<String, = QuietWriter>(); /** * Immediate flush means that the underlying writer or output stream = will be * flushed at the end of each append operation. Immediate flush is = slower * but ensures that each append request is actually written. If * <code>immediateFlush</code> is set to <code>false</code>, then there = is a * good chance that the last few logs events are not actually written = to * persistent media if and when the application crashes. *=20 * <p> * The <code>immediateFlush</code> variable is set to <code>true</code> = by * default. */ protected boolean immediateFlush =3D true; /** * The encoding to use when writing. * <p> * The <code>encoding</code> variable is set to <code>null</null> by default which results in the utilization of the system's default encoding. */ protected String encoding; /** * Controls file truncation. The default value for this variable is * <code>true</code>, meaning that by default a = <code>FileAppender</code> * will append to an existing file and not truncate it. *=20 * <p> * This option is meaningful only if the FileAppender opens the file. */ protected boolean fileAppend =3D true; /** * Do we do bufferedIO? */ protected boolean bufferedIO =3D false; /** * Determines the size of IO buffer be. Default is 8K. */ protected int bufferSize =3D 8 * 1024; private String fileName; public ConfigurableFileNameAppender() { super(); } public ConfigurableFileNameAppender(Layout layout, String filename) throws IOException { super(); this.setFile(filename); this.layout =3D layout; } public ConfigurableFileNameAppender(Layout layout, String filename, boolean append) throws IOException { this(layout, filename); this.fileAppend =3D append; } public ConfigurableFileNameAppender(Layout layout, String filename, boolean append, boolean bufferedIO, int bufferSize) throws IOException { this(layout, filename, append); this.bufferedIO =3D bufferedIO; this.bufferSize =3D bufferSize; } public void setFile(String file) { this.fileName =3D file; fileNamePatternLayout =3D new PatternLayout(fileName); } /** * If the value of <b>File</b> is not <code>null</code>, then * {@link #setFile} is called with the values of <b>File</b> and * <b>Append</b> properties. *=20 * @since 0.8.1 */ public void activateOptions() { if (fileName =3D=3D null) { LogLog.warn("FileName not set for appender [" + name + "]."); } } /** * this method can be overridden by the subclasses to improve the names *=20 * @param event * event to be logged. *=20 * Returns the file name following the pattern provided. *=20 * @since 0.1 */ protected String generateFileName(LoggingEvent event) { return fileNamePatternLayout.format(event); } protected void subAppend(LoggingEvent event) { // overrides super behavior creative a file depending on the file // pattern String currentFileName =3D generateFileName(event); QuietWriter qw =3D qwMap.get(currentFileName); if (qw =3D=3D null) { try { qw =3D createFile(currentFileName, fileAppend, bufferedIO, bufferSize); } catch (IOException e) { errorHandler.error("createFile(" + currentFileName + ", " + fileAppend + ") call failed."); } qwMap.put(currentFileName, qw); } qw.write(this.layout.format(event)); if (layout.ignoresThrowable()) { String[] s =3D event.getThrowableStrRep(); if (s !=3D null) { int len =3D s.length; for (int i =3D 0; i < len; i++) { qw.write(s[i]); qw.write(Layout.LINE_SEP); } } } if (this.immediateFlush) { qw.flush(); } } public synchronized void setFile(String fileName, boolean append, boolean bufferedIO, int bufferSize) throws IOException { } /** * <p> * Sets and <i>opens</i> the file where the log output will go. The * specified file must be writable. *=20 * <p> * If there was already an opened file, then the previous file is = closed * first. *=20 * <p> * <b>Do not use this method directly. To configure a FileAppender or = one of * its subclasses, set its properties one by one and then call * activateOptions.</b> *=20 * @param fileName * The path to the log file. * @param append * If true will append to fileName. Otherwise will truncate * fileName. */ public synchronized QuietWriter createFile(String fileName, boolean = append, boolean bufferedIO, int bufferSize) throws IOException { LogLog.debug("setFile called: " + fileName + ", " + append); // It does not make sense to have immediate flush and bufferedIO. if (bufferedIO) { setImmediateFlush(false); } FileOutputStream ostream =3D null; try { // // attempt to create file // ostream =3D new FileOutputStream(fileName, append); } catch (FileNotFoundException ex) { // // if parent directory does not exist then // attempt to create it and try to create file // see bug 9150 // String parentName =3D new File(fileName).getParent(); if (parentName !=3D null) { File parentDir =3D new File(parentName); if (!parentDir.exists() && parentDir.mkdirs()) { ostream =3D new FileOutputStream(fileName, append); } else { throw ex; } } else { throw ex; } } Writer fw =3D createWriter(ostream); if (bufferedIO) { fw =3D new BufferedWriter(fw, bufferSize); } QuietWriter qw =3D new QuietWriter(fw, errorHandler); writeHeader(qw); LogLog.debug("setFile ended"); return qw; } /** * Returns an OutputStreamWriter when passed an OutputStream. The = encoding * used will depend on the value of the <code>encoding</code> property. = If * the encoding value is specified incorrectly the writer will be = opened * using the default system encoding (an error message will be printed = to * the loglog. */ protected OutputStreamWriter createWriter(OutputStream os) { OutputStreamWriter retval =3D null; String enc =3D getEncoding(); if (enc !=3D null) { try { retval =3D new OutputStreamWriter(os, enc); } catch (IOException e) { LogLog.warn("Error initializing output writer."); LogLog.warn("Unsupported encoding?"); } } if (retval =3D=3D null) { retval =3D new OutputStreamWriter(os); } return retval; } public String getEncoding() { return encoding; } public void setEncoding(String value) { encoding =3D value; } /** * Sets the quiet writer being used. *=20 * This method is overriden by {@link RollingFileAppender}. */ protected void setQWForFiles(Writer writer) { // this.qw =3D new QuietWriter(writer, errorHandler); } /** * Clear internal references to the writer and other variables. *=20 * Subclasses can override this method for an alternate closing = behavior. */ protected void reset() { closeWriter(); this.qwMap =3D new HashMap<String, QuietWriter>(); } /** * Close the underlying {@link java.io.Writer}. * */ protected void closeWriter() { if (layout !=3D null) { for (QuietWriter writer : qwMap.values()) { if (writer !=3D null) { try { writer.close(); } catch (IOException e) { // There is do need to invoke an error handler at // this late // stage. LogLog.error("Could not close " + writer, e); } } } } } /** * Write a footer as produced by the embedded layout's * {@link Layout#getFooter} method. */ protected void writeFooter() { if (layout !=3D null) { String h =3D layout.getFooter(); if (h !=3D null) { for (QuietWriter writer : qwMap.values()) { if (writer !=3D null) { writer.write(h); writer.flush(); } } } } } /** * Write a header as produced by the embedded layout's * {@link Layout#getHeader} method. */ protected void writeHeader(QuietWriter writer) { if (layout !=3D null) { String h =3D layout.getHeader(); if (h !=3D null) { if (writer !=3D null) { writer.write(h); } } } } /** * Set the {@link ErrorHandler} for this WriterAppender and also the * underlying {@link QuietWriter} if any. */ public synchronized void setErrorHandler(ErrorHandler eh) { if (eh =3D=3D null) { LogLog.warn("You have tried to set a null error-handler."); } else { this.errorHandler =3D eh; for (QuietWriter writer : qwMap.values()) { if (writer !=3D null) { writer.setErrorHandler(eh); } } } } /** * This method determines if there is a sense in attempting to append. *=20 * <p> * It checks whether there is a set output target and also if there is = a set * layout. If these checks fail, then the boolean value = <code>false</code> * is returned. */ protected boolean checkEntryConditions() { if (this.closed) { LogLog.warn("Not allowed to write to a closed appender."); return false; } if (this.layout =3D=3D null) { errorHandler.error("No layout set for the appender named [" + name + "]."); return false; } return true; } /** * If the <b>ImmediateFlush</b> option is set to <code>true</code>, the * appender will flush at the end of each write. This is the default * behavior. If the option is set to <code>false</code>, then the = underlying * stream can defer writing to physical medium to a later time. *=20 * <p> * Avoiding the flush operation at the end of each append results in a * performance gain of 10 to 20 percent. However, there is safety = tradeoff * involved in skipping flushing. Indeed, when flushing is skipped, = then it * is likely that the last few log events will not be recorded on disk = when * the application exits. This is a high price to pay even for a 20% * performance gain. */ public void setImmediateFlush(boolean value) { immediateFlush =3D value; } /** * Returns value of the <b>ImmediateFlush</b> option. */ public boolean getImmediateFlush() { return immediateFlush; } /** * This method is called by the {@link AppenderSkeleton#doAppend} = method. *=20 * <p> * If the output stream exists and is writable then write a log = statement to * the output stream. Otherwise, write a single warning message to * <code>System.err</code>. *=20 * <p> * The format of the output will depend on this appender's layout. */ @Override public void append(LoggingEvent event) { // Reminder: the nesting of calls is: // // doAppend() // - check threshold // - filter // - append(); // - checkEntryConditions(); // - subAppend(); if (!checkEntryConditions()) { return; } subAppend(event); } /** * Close this appender instance. The underlying stream or writer is = also * closed. *=20 * <p> * Closed appenders cannot be reused. *=20 * @see #setWriter * @since 0.8.4 */ @Override public synchronized void close() { if (this.closed) return; this.closed =3D true; writeFooter(); reset(); } @Override public boolean requiresLayout() { return false; } /** * The <b>Append</b> option takes a boolean value. It is set to * <code>true</code> by default. If true, then <code>File</code> will = be * opened in append mode by {@link #setFile setFile} (see above). = Otherwise, * {@link #setFile setFile} will open <code>File</code> in truncate = mode. *=20 * <p> * Note: Actual opening of the file is made when {@link = #activateOptions} is * called, not when the options are set. */ public void setAppend(boolean flag) { fileAppend =3D flag; } /** * Returns the value of the <b>Append</b> option. */ public boolean getAppend() { return fileAppend; } } ------=_NextPart_000_0025_01C9553B.75E8C3F0 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org ------=_NextPart_000_0025_01C9553B.75E8C3F0-- From log4j-dev-angelaoliver@example.org Wed Dec 03 14:58:37 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 34630 invoked from network); 3 Dec 2008 14:58:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Dec 2008 14:58:37 -0000 Received: (qmail 9482 invoked by uid 500); 3 Dec 2008 14:58:49 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 9457 invoked by uid 500); 3 Dec 2008 14:58:49 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 9446 invoked by uid 99); 3 Dec 2008 14:58:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 06:58:49 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of angelaoliver@example.org designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO mail.qos.ch) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 14:57:19 +0000 Received: by mail.qos.ch (Postfix, from userid 1006) id 8AC6016960E; Wed, 3 Dec 2008 16:05:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.4-gr0 (2008-01-01) on torino X-Spam-Level: Received: from [83.161.120.155] (unknown [83.161.120.155]) by mail.qos.ch (Postfix) with ESMTP id 391A716960E for <angelaoliver@example.org>; Wed, 3 Dec 2008 16:05:22 +0100 (CET) Message-ID: <angelaoliver@example.org> Date: Wed, 03 Dec 2008 15:57:43 +0100 From: Ceki Gulcu <angelaoliver@example.org> User-Agent: Thunderbird 83.161.120.155 (Windows/20081105) MIME-Version: 1.0 To: Log4J Developers List <angelaoliver@example.org> Subject: Re: runtime configurable file name appender References: <angelaoliver@example.org> In-Reply-To: <angelaoliver@example.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-4.4 required=5.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.4-gr0 This is nicely related to the repository selector discussion, Jake and I had on 30.11.2008. Well done. Eduardo Arantes Rodrigues wrote: > Hi, > > I had a specific requirement that a certain set of similar Jobs should > be logged one individual file per Job. > That would make things easier to troubleshooting. > With the current FileAppenders implementation it would require a new > appender and category for each Job. > Since, so far, we have already 20 jobs it would be really painful to add > and maintain all of them and also the Jobs can be dynamically added to > the system. > That would break the rule of having one file per Jobs. > > I've researched but I couldn't find an appender where the name of the > file to log could be configured dynamically. > > Given this requirements my idea was provide a way to use PatternLayout > like file names. > > This code allow the fileName to be defined as: "c:/temp/server[%-5p].log" > Depending on the pattern a new file can be generated by class, category > or even by day, hour, ... > > I've used the FileAppender code as base > > I've provide the JavaDoc for the most important methods. > > I hope it's useful and can be added to the project > > Regards, > Eduardo -- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org From log4j-dev-angelaoliver@example.org Wed Dec 03 15:09:18 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 79051 invoked from network); 3 Dec 2008 15:09:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 3 Dec 2008 15:09:18 -0000 Received: (qmail 33202 invoked by uid 500); 3 Dec 2008 15:09:29 -0000 Delivered-To: angelaoliver@example.org Received: (qmail 33178 invoked by uid 500); 3 Dec 2008 15:09:29 -0000 Mailing-List: contact angelaoliver@example.org; run by ezmlm Precedence: bulk List-Unsubscribe: <mailto:angelaoliver@example.org> List-Help: <mailto:angelaoliver@example.org> List-Post: <mailto:angelaoliver@example.org> List-Id: "Log4J Developers List" <log4j-dev.logging.apache.org> Reply-To: "Log4J Developers List" <angelaoliver@example.org> Delivered-To: mailing list angelaoliver@example.org Received: (qmail 33167 invoked by uid 99); 3 Dec 2008 15:09:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Dec 2008 07:09:29 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of angelaoliver@example.org designates 83.161.120.155 as permitted sender) Received: from [83.161.120.155] (HELO hm784.locaweb.com.br) (83.161.120.155) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 03 Dec 2008 15:07:58 +0000 Received: (qmail 31837 invoked from network); 3 Dec 2008 15:07:58 -0000 Received: from unknown (83.161.120.155) by hm784.locaweb.com.br with QMQP; 3 Dec 2008 15:07:58 -0000 Received: from unknown (HELO DIRERodrigues) (angelaoliver@example.org@83.161.120.155) by hm939.locaweb.com.br with SMTP; 3 Dec 2008 15:07:57 -0000 Reply-To: <angelaoliver@example.org> From: "Eduardo Arantes Rodrigues" <angelaoliver@example.org> To: "'Log4J Developers List'" <angelaoliver@example.org> References: <angelaoliver@example.org> <angelaoliver@example.org> Subject: RE: runtime configurable file name appender Date: Wed, 3 Dec 2008 13:07:53 -0200 Organization: =?iso-8859-1?Q?Trigger_Solu=E7=F5es?= Message-ID: <angelaoliver@example.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AclVV6Z1x0u+qhjQSlumf6XdFXxF0AAASUxA In-Reply-To: <angelaoliver@example.org> X-Virus-Checked: Checked by ClamAV on apache.org That's the first draft. If you have more features that would fit in here I'd be glade to add. Just let me know.=20 > -----Original Message----- > From: Ceki Gulcu [mailto:angelaoliver@example.org]=20 > Sent: Wednesday, December 03, 2008 12:58 PM > To: Log4J Developers List > Subject: Re: runtime configurable file name appender >=20 > This is nicely related to the repository selector discussion,=20 > Jake and I had on 30.11.2008. Well done. >=20 > Eduardo Arantes Rodrigues wrote: > > Hi, > > =20 > > I had a specific requirement that a certain set of similar=20 > Jobs should=20 > > be logged one individual file per Job. > > That would make things easier to troubleshooting. > > With the current FileAppenders implementation it would=20 > require a new=20 > > appender and category for each Job. > > Since, so far, we have already 20 jobs it would be really=20 > painful to=20 > > add and maintain all of them and also the Jobs can be dynamically=20 > > added to the system. > > That would break the rule of having one file per Jobs. > > =20 > > I've researched but I couldn't find an appender where the=20 > name of the=20 > > file to log could be configured dynamically. > > =20 > > Given this requirements my idea was provide a way to use=20 > PatternLayout=20 > > like file names. > > =20 > > This code allow the fileName to be defined as:=20 > "c:/temp/server[%-5p].log" > > Depending on the pattern a new file can be generated by class,=20 > > category or even by day, hour, ... > > =20 > > I've used the FileAppender code as base > > =20 > > I've provide the JavaDoc for the most important methods. > > =20 > > I hope it's useful and can be added to the project > > =20 > > Regards, > > Eduardo >=20 > -- > Ceki G=FClc=FC > Logback: The reliable, generic, fast and flexible logging=20 > framework for Java. > http://logback.qos.ch >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: angelaoliver@example.org > For additional commands, e-mail: angelaoliver@example.org >=20 >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: angelaoliver@example.org For additional commands, e-mail: angelaoliver@example.org From log4j-dev-angelaoliver@example.org Thu Dec 04 01:20:27 2008 Return-Path: <log4j-dev-angelaoliver@example.org> Delivered-To: angelaoliver@example.org Received: (qmail 61111 invoked from network); 4 Dec 2008 01:20:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with
{'source': 'Apache Software Foundation Public Mail Archives'}