You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Shaily Goel <gs...@novell.com> on 2004/09/20 10:47:39 UTC

configuration of Log4Net Environment

Currently I am using a configuration file to configure log4net
environment..The format of this configuration file is specified by
Log4net which is mentioned below in mail

I am using DOMConfigurator.ConfigureAndWatch(FileInfo ConfigFile) API
to configure the envioronment

But Is it possible that i can configure various appenders and initilize
the log4net  environment myself without using this configuration file or
XmlBlob(DomConfigurator API)?

The idea is that  I want to initlize the log4net environment and
various appenders without using configuration file or xmlBlob.If  I know
the settings of various appenders which needs to be applied then i
should be able to apply those settings directly to appenders and
initilize them if they are not or update the appender's settings if they
are already initlized .There should be no need of creating the xml file
or xmlBlob and then giving that XmlBlob to DomConfigurator for
configuring various appenders.Is it compulsary to use DomConfigurator to
configure log4net environment?What DomConfigurator actually do?


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<log4net debug="true">
	<appender names="RollingFileAppender"
type="log4net.Appender.RollingFileAppender">
	<param name="File"
value="/home/sgoyal/loggerframework/log4net/final/LocalLog.txt" />
	<param name="appendToFile" value="true" />
	<param name="maxSizeRollBackups" value="2" />
	<param name="maximumFileSize" value="1MB" />
	<layout type="Novell.Rce.logger.SimpleLayout, LoggerModule.dll">
</layout>
	</appender> 

	<!--Appender to log event into syslog-->
	<appender name="SysLog" type="Novell.Rce.logger.SyslogAppender,
LoggerModule.dll">
	  <param name="Facility" value="USER" />
	  <!--INFO & above will be logged to syslog Threshold can be any
one of debug, info, warn or error-->
          <param name="Threshold" value="debug" />
	  <layout type="Novell.Rce.logger.SimpleLayout,
LoggerModule.dll"> </layout>
	</appender>

	<!--Appender to send event into Central Log Service-->
	<appender name="CENTRAL_LOG"
type="Novell.Rce.logger.CentralLogServiceAppender, LoggerModule.dll">
	  <!--specify the IP address or dns name of the machine where
Central Log Service is hosted-->	
	  <param name="CentralServerAddress" value="164.99.149.177" /> 
	  <!--specify the port number on which Tomcat is listening-->
	  <param name="port" value="8080" /> 
	  <param name="reconnectionDelay" value="3000" /> 
	  <param name="maxQueueSize" value="2000" /> 
	  <param name="timeout" value="5000" /> 
	  <!--INFO & above will be sent to central log service.
Threshold can be any one of debug,info, warn or error-->
          <param name="Threshold" value="debug"/>
	</appender>

	<!--This section is used to enable or disable the above
configured appenders
	    appender mentioned in this section only will be loaded by
Log4J.-->
	<root> 
           <appender-ref ref="CENTRAL_LOG"/>
	   <appender-ref ref="RollingFileAppender"/>
           <appender-ref ref="SysLog"/>
   
	   
	   <!-- uncomment the following line to enable
CentralLogServiceAppender, Before that make sure CentralLogService is
		up-->
	   <!--	
	   <appender-ref ref="SMTP"/> 
	   <appender-ref ref="RollingFileAppender"/>
           <appender-ref ref="SysLog"/>
	   <appender-ref ref="CENTRAL_LOG"/>
	   <appender-ref ref="SysLog"/>
	   <appender-ref ref="CENTRAL_LOG"/>
	   -->	
	</root>	
</log4net>


Thanks
Shaily