As another option, I place the log4j.properties file in the src directory in
Eclipse so that it gets loaded into the classpath. But of course either way
works...
On 5/11/07, Niklas Therning <[EMAIL PROTECTED]> wrote:
I usually use Log4j's PropertyConfigurator to load my log4j.properties
in my main() method:
PropertyConfigurator.configure("/path/to/log4j.properties");
Add something like that before you do anything else in main() and it
should work.
/Niklas
Tan Ka Ju wrote:
> FYI, I have tried replacing slf4j-log4j12-1.3.1.jar with
> slf4j-simple.jar and
> Logging works. :) Thanks.
>
> However, it would very great if you can guide me on what is the error I
>
> encounter when using the log4j as mentioned in previous mail.
>
> rgds,
> KJ
>
>
>>>> "Tan Ka Ju" <[EMAIL PROTECTED]> 05/11/07 4:26 pm >>>
>>>>
> Hi Niklas,
>
> I actually included slf4j-log4j12-1.3.1.jar and log4j-1.3alpha-8.jar
> in
> my classpath.
> I have also included a log4j.properties file ( see below ). When I run
> it, it does
> not produce any log messages. Do I need to add any code or bindings in
> my
> ClientSessionHandler?
>
> ======== log4j.properties file ========
> log4j.rootLogger=debug, stdout, R
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>
> # Pattern to output the caller's file name and line number.
> log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=example.log
>
> log4j.appender.R.MaxFileSize=100KB
> # Keep one backup file
> log4j.appender.R.MaxBackupIndex=1
>
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>
> Thanks.
>
> Rgds,
> KJ.
>
>
>>>> Niklas Therning <[EMAIL PROTECTED]> 05/11/07 3:44 pm >>>
>>>>
> Tan Ka Ju wrote:
>
>> Hello Niklas,
>>
>> I was trying the sample of the SumUp in MINA1.1 using Netbeans
>> under WindowsXP, jdk1.5.
>>
>> My problem is I do not know where is the logfile that should be
>> generated by the SessionLog. Can you guide me?
>>
>>
> Hi,
>
> The SessionLog uses SLF4J which is a logging facade for various
> logging
> APIs (similar to Commons Logging). You probably have slf4j-nop.jar in
> your class path, right? In that case nothing will be logged. If you
> replace it with slf4j-simple.jar log messages with level INFO and
> higher
> will be logged to the console. If you want to use log4j you should use
> either slf4j-log4j12.jar or slf4j-log4j13.jar and then you just set up
> log4j as usual.
>
> You will find all these jars through the SLF4J home page as well as
> the
> manual: http://www.slf4j.org
>
> PS: I'm CCing this reply to the MINA mailing list. Please send your
> questions there in the future. It's the best way to get help on MINA.
>
>
--
Niklas Therning
www.spamdrain.net
--
..Cheers
Mark