logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: logging to DB2
Date Wed, 15 Dec 2004 22:17:59 GMT
Thanks. 

> -----Original Message-----
> From: M. d'Entremont [mailto:mdent@crm3.com] 
> Sent: 15 December 2004 20:40
> To: Log4NET User
> Subject: Re: logging to DB2
> 
> DB2 8.2, a.k.a Stinger
> 
> It's their most recent to date. Pretty much every thing 
> should be similar on old versions with slight syntactic changes
> 
> Marc
> 
> Nicko Cadell wrote: 
> 
> 	Marc,
> 	
> 	Thanks for the schema and config.
> 	Can you tell me which version of db2 you have this working on? 
> 	
> 	Many thanks,
> 	Nicko
> 	
> 	  
> 
> 		-----Original Message-----
> 		From: M. d'Entremont [mailto:mdent@crm3.com] 
> 		Sent: 11 December 2004 01:12
> 		To: Log4NET User
> 		Subject: logging to DB2
> 		
> 		I've got log4net logging to db2. I thought this 
> could be 
> 		helpful to someone.
> 		
> 		Note: The level field was slightly problematic 
> as it was 
> 		initially 50 varchars, but log4net seems to 
> send the whole 
> 		string even when larger then 50. It therefore 
> produced a 
> 		right truncation error.
> 		Beyond that the table create, connectionType and 
> 		connectionString where the only changes
> 		
> 		Thanks
> 		It's a great project
> 		Marc
> 		
> 		CREATE TABLE "myschema.LOG"  (
> 		          "ID" INTEGER NOT NULL   GENERATED 
> ALWAYS AS IDENTITY (  
> 		            START WITH +1  
> 		            INCREMENT BY +1  
> 		            MINVALUE +1  
> 		            MAXVALUE +2147483647  
> 		            NO CYCLE  
> 		            NO CACHE  
> 		            NO ORDER ) , 
> 		          "DATE" TIMESTAMP NOT NULL , 
> 		          "THREAD" VARCHAR(255) NOT NULL, 
> 		          "LEVEL" VARCHAR(500) NOT NULL, 
> 		          "LOGGER" VARCHAR(255) NOT NULL, 
> 		          "MESSAGE" VARCHAR(4000) NOT NULL, 
> 		          "EXCEPTION" VARCHAR(2000) )   
> 		         IN "LRGTABLES" ;         
> 		         
> 		         
> 		<?xml version="1.0" encoding="utf-8" ?>
> 		<configuration>
> 		  <configSections>
> 		    <section name="log4net" 
> 		      
> type="log4net.Config.Log4NetConfigurationSectionHandler,
> 		            log4net-net-1.0" 
> 		    />
> 		  </configSections>
> 		
> 		  <log4net>
> 		    
> 		    <logger name="collectEmail">
> 		      <level value="DEBUG"/>
> 		    </logger>
> 		    
> 		    <root>
> 		      <level value="DEBUG" />
> 		      <appender-ref ref="LogFileAppender" />
> 		      <appender-ref ref="ConsoleAppender" />
> 		       <appender-ref ref="ADONetAppender" />
> 		    </root>
> 		    
> 		    <appender name="LogFileAppender" 
> 		             type="log4net.Appender.FileAppender" >
> 		      <param name="File" value="c:\\log-file.txt" />
> 		      <param name="AppendToFile" value="true" />
> 		      <layout type="log4net.Layout.PatternLayout">
> 		        <param name="Header" value="[Header]\r\n"/>
> 		        <param name="Footer" value="[Footer]\r\n"/>
> 		        <param name="ConversionPattern" 
> 		           value="%d [%t] %-5p %c [%x]  - %m%n"
> 		         />
> 		      </layout>
> 		      <!--
> 		      <filter type="log4net.Filter.LevelRangeFilter">
> 		        <param name="LevelMin" value="DEBUG" />
> 		        <param name="LevelMax" value="WARN" />
> 		      </filter>    -->
> 		    </appender>
> 		
> 		    <appender name="ConsoleAppender" 
> 		              type="log4net.Appender.ConsoleAppender" >
> 		      <layout type="log4net.Layout.PatternLayout">
> 		        <param name="ConversionPattern" 
> 		           value="%d [%t] %-5p %c [%x]  - %m%n" 
> 		        />
> 		      </layout>
> 		    </appender>
> 		    
> 		    <appender name="ADONetAppender" 
> 		type="log4net.Appender.ADONetAppender">
> 		    <bufferSize value="1" />
> 		    <connectionType 
> 		value="IBM.Data.DB2.DB2Connection,IBM.Data.DB2, 
> Version=8.1.2.1" />
> 		    <connectionString 
> 		value="server=192.168.0.0;database=dbuser;user 
> 		Id=username;password=password;persist security 
> info=true" />
> 		    <commandText value="INSERT INTO CNTMGR.Log 
> 		(Date,Thread,Level,Logger,Message,Exception) VALUES 
> 		(@log_date, @thread, @log_level, @logger, 
> @message, @exception)" />
> 		    <parameter>
> 		        <parameterName value="@log_date" />
> 		        <dbType value="DateTime" />
> 		        <layout 
> type="log4net.Layout.RawTimeStampLayout" />
> 		    </parameter>
> 		    <parameter>
> 		        <parameterName value="@thread" />
> 		        <dbType value="String" />
> 		        <size value="255" />
> 		        <layout type="log4net.Layout.PatternLayout">
> 		            <conversionPattern value="%thread" />
> 		        </layout>
> 		    </parameter>
> 		    <parameter>
> 		        <parameterName value="@log_level" />
> 		        <dbType value="String" />
> 		        <size value="500" />
> 		        <layout type="log4net.Layout.PatternLayout">
> 		            <conversionPattern value="%level" />
> 		        </layout>
> 		    </parameter>
> 		    <parameter>
> 		        <parameterName value="@logger" />
> 		        <dbType value="String" />
> 		        <size value="255" />
> 		        <layout type="log4net.Layout.PatternLayout">
> 		            <conversionPattern value="%logger" />
> 		        </layout>
> 		    </parameter>
> 		    <parameter>
> 		        <parameterName value="@message" />
> 		        <dbType value="String" />
> 		        <size value="4000" />
> 		        <layout type="log4net.Layout.PatternLayout">
> 		            <conversionPattern value="%m" />
> 		        </layout>
> 		    </parameter>
> 		    <parameter>
> 		        <parameterName value="@exception" />
> 		        <dbType value="String" />
> 		        <size value="2000" />
> 		        <layout type="log4net.Layout.ExceptionLayout" />
> 		    </parameter>
> 		</appender>
> 		    
> 		  </log4net>
> 		</configuration>
> 		
> 		
> 		  
> 		
> 		
> 		.
> 		
> 		
> 		    
> 
> 
> -- 
> 
> Marc d'Entremont	 Ph: (250) 386-4266	 
> Convergent Media Network	 Fax: (250) 386-4267	 
> 210-19 Dallas Rd.	 Mobile: (250) 886-8665	 
> Victoria, BC	 mdent@crm3.com	 
> V8V 5A6	 
> 
> 
>           
> 
> This electronic message transmission, including any attached 
> files, contains information which may be confidential and/or 
> privileged. The information is intended to be for the SOLE 
> use of the individual or entity named above. If you are not 
> the intended recipient, be aware that any review, disclosure, 
> copying, distribution or use of the contents of this 
> information is prohibited.  This message is not to be 
> forwarded for any reason without prior consent of the sender.
> 
> If you have received this electronic transmission in error, 
> please notify the sender immediately by telephone (250) 
> 386-4266 or by a "reply to sender only" message and destroy 
> all electronic and hard copies of the communication, 
> including attachments, without reading or saving in any manner.
> 
> 

Mime
View raw message