logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jimmy Mehta <jme...@translations.com>
Subject Re: LOG4J - Different priority messages to different files
Date Mon, 05 Nov 2007 23:11:12 GMT

hey James,

No prob but i just make some changes in Log4j.properties file and its
working fine now,

Appreciate your help

Jimmy

James A. N. Stauffer wrote:
> 
> I don't use a properties config file but that looks correct to me.
> 
> On 11/5/07, Jimmy Mehta <jmehta@translations.com> wrote:
>>
>>
>> Hey James,
>>
>> Thank you so much and i appreciate your help , i ma playing with
>> log4j.properties file i didnt touch JAVA file but now i am able to get
>> job
>> messages to diffrent file and org to different file but now i a facing
>> problem is that i am not able to set priority properly ,if i am setting
>> priority on JOB folder = warn but it display info messages also so i am
>> not
>> able to get only messages that has high priority then warn,
>>
>> this is my code
>> # Two appenders , one for file and one for Console
>> log4j.rootCategory=warn , dest1 , console
>>
>> log4j.logger.Job = warn , FileAppenderForJob
>> log4j.logger.User = error , FileAppenderForUser
>> log4j.logger.Organization = info , FileAppenderForOrganization
>>
>>
>> # First Appender writes to the console
>> log4j.appender.console = org.apache.log4j.ConsoleAppender
>> log4j.appender.console.layout = org.apache.log4j.PatternLayout
>>
>> # to display file name and line number
>> log4j.appender.console.layout.ConversionPattern = %5p [%t] (%F:%L) - %m%n
>>
>> #Second Appender writes to the File
>> log4j.appender.dest1 = org.apache.log4j.RollingFileAppender
>> log4j.appender.dest1.File = example.log
>> log4j.appender.dest1.MaxFileSize = 100KB
>> log4j.appender.dest1.MaxBackupIndex = 1
>> log4j.appender.dest1.layout = org.apache.log4j.PatternLayout
>> log4j.appender.dest1.layout.ConversionPattern= %d %p [%t] (%c) - %m%n
>>
>> #Appender writes to the JobFile
>> log4j.appender.FileAppenderForJob = org.apache.log4j.RollingFileAppender
>> log4j.appender.FileAppenderForJob.File = Job.log
>> log4j.appender.FileAppenderForJob.MaxFileSize = 100KB
>> log4j.appender.FileAppenderForJob.MaxBackupIndex = 1
>> log4j.appender.FileAppenderForJob.layout = org.apache.log4j.PatternLayout
>> log4j.appender.FileAppenderForJob.layout.ConversionPattern= %d %p [%t]
>> (%c)
>> - %m%n
>>
>> #Appender writes to the UserFile
>> log4j.appender.FileAppenderForUser = org.apache.log4j.RollingFileAppender
>> log4j.appender.FileAppenderForUser.File = User.log
>> log4j.appender.FileAppenderForUser.MaxFileSize = 100KB
>> log4j.appender.FileAppenderForUser.MaxBackupIndex = 1
>> log4j.appender.FileAppenderForUser.layout =
>> org.apache.log4j.PatternLayout
>> log4j.appender.FileAppenderForUser.layout.ConversionPattern= %d %p [%t]
>> (%c)
>> - %m%n
>>
>> #Appender writes to the OrganizationFile
>> log4j.appender.FileAppenderForOrganization =
>> org.apache.log4j.RollingFileAppender
>> log4j.appender.FileAppenderForOrganization.File = Organization.log
>> log4j.appender.FileAppenderForOrganization.MaxFileSize = 100KB
>> log4j.appender.FileAppenderForOrganization.MaxBackupIndex = 1
>> log4j.appender.FileAppenderForOrganization.layout =
>> org.apache.log4j.PatternLayout
>> log4j.appender.FileAppenderForOrganization.layout.ConversionPattern= %d
>> %p
>> [%t] (%c) - %m%n
>>
>> So can you please se and tell me whats the problem?
>>
>> Jimmy
>>
>> James A. N. Stauffer wrote:
>> >
>> > http://logging.apache.org/log4j/1.2/manual.html shows an example for
>> the
>> > logger "com.foo":
>> >
>> > *log4j.logger.com.foo=WARN*
>> >
>> >
>> > On 11/5/07, Jimmy Mehta <jmehta@translations.com> wrote:
>> >>
>> >>
>> >> Hey James,
>> >>
>> >> Thank you so much for your mail...i get your suggestion but i am still
>> >> not
>> >> sure how to attach appender to the Job package or user Package or
>> Address
>> >> Package because i know this thing that we can attach appender to the
>> root
>> >> category as per example  log4j.rootCategory= console. but how should i
>> >> attach appender to individual package. Can you please give me sample
>> code
>> >> ,it will be appreciated and clear my self.
>> >>
>> >> Jimmy
>> >>
>> >> James A. N. Stauffer wrote:
>> >> >
>> >> > You shouldn't need to use incorrect levels in your classes.  Just
>> >> attach
>> >> > one
>> >> > appender to the Job logger and another appender to the Address and
>> User
>> >> > loggers.
>> >> >
>> >> > On 11/1/07, Jimmy Mehta <jmehta@translations.com> wrote:
>> >> >>
>> >> >>
>> >> >> Hey James ,
>> >> >>
>> >> >> Thanks for you reply now i find another way that , i have three
>> >> classes
>> >> >> Job
>> >> >> , Address , User. Now i want to put All messages of Job class into
>> >> >> separate
>> >> >> file and all Address messages to another file and same as in User.
>> So
>> >> if
>> >> >> i
>> >> >> set priority level in Job class like warn so all fatal , error
and
>> >> warn
>> >> >> messages of Job class goes to one file and no any other class
>> messages
>> >> so
>> >> >> how can i do it with Properties file??
>> >> >>
>> >> >> Can you give me one sample code example so i can understand more
>> >> >> clearly..
>> >> >>
>> >> >> Appreciate ur help
>> >> >>
>> >> >> Jimmy Mehta
>> >> >>
>> >> >> James A. N. Stauffer wrote:
>> >> >> >
>> >> >> > I find that I want one file for each level and higher.  i.e.
>> >> >> Warn.loghas
>> >> >> > warn, error, and fatal messages.  That can easily be done
by
>> setting
>> >> >> > thresholds on each appender.  If you want only a certain level
>> then
>> >> you
>> >> >> > can
>> >> >> > use a level match filter but that requires XML config.
>> >> >> >
>> >> >> > On 10/31/07, Jimmy Mehta <jmehta@translations.com> wrote:
>> >> >> >>
>> >> >> >>
>> >> >> >> Hi,
>> >> >> >>
>> >> >> >> I am new to the LOG4J and i am trying to learn so i have
a
>> question
>> >> >> that
>> >> >> >> if
>> >> >> >> i need to put different priority log messages to different
log
>> >> files.
>> >> >> >> Suppose i want to put all warn messages to one file and
all info
>> >> >> messages
>> >> >> >> to
>> >> >> >> another file and all error messages to another file. My
root
>> >> priority
>> >> >> is
>> >> >> >> Info and I also set different packages to different priority
>> level.
>> >> >> >>
>> >> >> >> Suppose com.tc.portal.xyz = info so how should i put different
>> >> >> priority
>> >> >> >> messages to different file
>> >> >> >>
>> >> >> >> Main thing , i want to make only change in log4j.properties
file
>> ,
>> >> i
>> >> >> >> don't
>> >> >> >> want to change java files
>> >> >> >>
>> >> >> >> Jimmy
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13519537
>> >> >> >> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail:
>> log4j-user-unsubscribe@logging.apache.org
>> >> >> >> For additional commands, e-mail:
>> log4j-user-help@logging.apache.org
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > James A. N. Stauffer
>> http://www.geocities.com/stauffer_james/
>> >> >> > Are you good? Take the test at http://www.livingwaters.com/good/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13535224
>> >> >> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> >> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > James A. N. Stauffer        http://www.geocities.com/stauffer_james/
>> >> > Are you good? Take the test at http://www.livingwaters.com/good/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13592319
>> >> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > James A. N. Stauffer        http://www.geocities.com/stauffer_james/
>> > Are you good? Take the test at http://www.livingwaters.com/good/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13594570
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
> 
> 
> -- 
> James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
> 
> 

-- 
View this message in context: http://www.nabble.com/LOG4J---Different-priority-messages-to-different-files-tf4728211.html#a13597747
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Mime
View raw message