Thanx a lot. How to Config the com.mydoain.database, In the log4j.properties files, I use com.mydomain.database, it gives the information of : log4j:ERROR Could not find value for key or log4j.logger.com.mydoain.database = INFO A2 log4j:ERROR Could not instantiate appender named " com.mydoain.database =INFO A2".
-----Original Message----- From: Steve Ebersole [mailto:[EMAIL PROTECTED] Sent: 2003年3月12日 9:35 To: Log4J Users List Subject: Re: how to output to different files with different information You should really consider switching to Logger. All the old classes (Category being one of them) have been deprecated (although only unofficially, as they are not marked as such in javadocs) and are scheduled to be removed sometime later this year. That being said, the syntax using the Category class would be: Category cat = Category.getInstance("com.mydomain.database"); ----- Original Message ----- From: "cnyinhua" <[EMAIL PROTECTED]> To: "'Log4J Users List'" <[EMAIL PROTECTED]> Sent: Tuesday, March 11, 2003 6:57 PM Subject: RE: how to output to different files with different information Thanks a lot But I use the Category, how can I get the com.mydomain.database by Category? -----Original Message----- From: Steve Ebersole [mailto:[EMAIL PROTECTED] Sent: 2003年3月11日 19:35 To: Log4J Users List Subject: Re: how to output to different files with different information Can you include your log4j.properties file? Strictly based on the names of the files, it seems you want certain log messages to go to A1 and all others to go to A2; then irregardless of whether a message went to A1 or A2, also log it to A3. That correct? In general that would be setup as: log4j.rootLogger=INFO, A3 log4j.logger.com.mydomain.database=INFO, A1 log4j.logger.com.mydomain.other=INFO, A2 Then in your code: Logger dbLog = Logger.getLogger( "com.mydomain.database" ); Logger otherLog = Logger.getLogger( "com.mydomain.other" ); I use this approach mainly for DB conversion programs where I need an audit log and an exception log. If you didnt want to use 2 distinct loggers, you could look at using an approach utilizing MDC. But in order to get that into 2 seperate files you would need to utilize Filters (which would additional mean a change to an XML config file). ----- Original Message ----- From: "cnyinhua" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 11, 2003 12:45 AM Subject: how to output to different files with different information > HI, all > I have modified the log4j.properties, and add A1, A2, A3 to the > appenders. A1 is related to the database.log file, A2 is related to the > other.log, A3 is the all.log. > In the application, I want to get a instance of the Category and output > the specific information to the related files, but now all the files are > the same, how can I implement it in the same class. > Thanks. > Any help will be welcome! > Frank > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]