logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Kristensen <akristen...@dynamicsoft.com>
Subject Re: can Log4j configuration file be bundled with applications property file
Date Fri, 01 Jun 2001 21:06:22 GMT
Works for me! With the following test program:

package test.log4j;

import org.apache.log4j.*;

public class HelloWorld {
    public static void main(String[] args) throws Exception {
        Category cat = Category.getInstance(HelloWorld.class);
        cat.debug("hi there");
        cat.info("how's it going?");
    }
}

I get:

2001-06-01 16:36:21,622 DEBUG                 test.log4j.HelloWorld    
- hi there
2001-06-01 16:36:21,652 INFO                  test.log4j.HelloWorld    
- how's it going?

which looks about right.

Anders


korosh wrote:
> 
> below is the contents of the property file. some values/varibles changed to
> protect the innocent.
> 
> -------------------------------------------
> # property file.   log4j enteries are at the end of this file.
> 
> #
> # some other logging function not related to log4j
> logging.filename=MyServer
> logging.dir=/export/home/myserver/myservletengine/servlet/ServletLogs
> 
> ############################################################################
> ##########
> # Properties used by another server
> ############################################################################
> ##########
> 
> #by the Server ( in minutes ).
> message.delay_minutes=15
> message.time_format=HH':'mm
> message.date_format=MM'/'dd
> message.use_date_for_old_message=true
> 
> #The channel on which the we broadcast
> #BCAST=BCHANNEL
> 
> ############################################################################
> ##########
> # Properties used by the xxxx
> ############################################################################
> ##########
> 
> #Connection information for Informix
> profiles.jdbc_url=jdbc:informix-sqli://me.myserver.com:1525/eeeee:INFORMIXSE
> RVER=xxx
> profiles.jdbc_username=xxxxx
> profiles.jdbc_password=xxxxx
> profiles.jdbc_class=com.informix.jdbc.IfxDriver
> 
> ############################################################################
> ###
> # Properties used by Sea
> ############################################################################
> ###
> 
> #The search database table name
> #search.jdbc_table=ps_search_master
> 
> #The class of the database driver
> #search.jdbc_class=com.informix.jdbc.IfxDriver
> 
> #minutes between reads of updates to seach master table
> #search.refresh_minutes=15
> 
> search.refresh_minutes=15
> 
> ############################################################################
> ###
> # Properties used by xxxxx
> ############################################################################
> ###
> news.proxied_server_name = http://news.someserver.com/news
> news.symbol_to_url_rule = sds_hl.asp?symbol=%s&clients=7899
> news.default_url = sds_hl.asp?symbol=&clients=7899
> news.error_text.0 = ODBC Drivers error
> news.error_text.1 = Server object error
> news.error_text.2 = Server.CreateObject
> 
> ############################################################################
> ###
> # Properties used by statistics server
> ############################################################################
> ###
> log4j.rootCategory=, A1
> # log4j.appender.A1=org.apache.log4j.ConsoleAppender
> log4j.appender.A1=org.apache.log4j.FileAppender
> log4j.appender.A1.File=MyLog.log
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %37c %3x - %m%n
> log4j.category.com.mycomp.HandlerServlet=INFO
> log4j.category.com.mycomp.Handler1=INFO
> log4j.category.com.mycomp.Handler2.DB=WARN
> log4j.category.com.mycomp.DatabaseConnectionPool.DB=INFO
> log4j.category.com.mycomp.HandlerFactory=INFO
> jdbcClassName=com.informix.jdbc.IfxDriver
> poolsize=5
> databaseURL=jdbc:informix-sqli://myserver:1532/mydb:INFORMIXSERVER=myserver
> username=xxxxx
> password=xxxxx
> 
> -------------------------------------------------
> -----Original Message-----
> From: Anders Kristensen [mailto:akristensen@dynamicsoft.com]
> Sent: Thursday, May 31, 2001 9:45 PM
> To: LOG4J Users Mailing List
> Subject: Re: can Log4j configuration file be bundled with applications
> property file
> 
> I think what you're describing ought to work just fine. Can you send a
> properties file that contains non-log4j entries and which fails
> configuring correctly?
> 
> Anders
> 
> korosh wrote:
> >
> > Hi,
> >
> > I have a web application that uses Log4j.
> >
> > I have alot of properties associated with this web application that I read
> > off of a main property file.
> >
> > Wonderining if I could take all of the log4j varible=value pairs and just
> > put them into this property file, call it myprops.properties and then feed
> > this to the log4j configurator like:
> >
> > PropertyConfigurator.configure( myprops.properties )
> >
> > ???
> >
> > I tried the above, but the log4j complained that no appender defined for
> A1
> > (my appender).
> >
> > I took the log4j varible/value pairs out of myprops.properties and put
> them
> > into a seperate file and that did the job.
> >
> > all the entires in myprops.properties are varible/value pairs anyways. I
> > assumed PropertyConfigurator would simply throw away all the other
> > properties and only load the log4j.* entries.
> >
> > any ideas?
> >
> > i'd rather have one property file for my application only.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message