slf4j configuration

View: New views
10 Messages — Rating Filter:   Alert me  

slf4j configuration

by arj123 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

I am using MINA-2.0.0M1

I am configuring the slf4j using log4j.properties file.

This file looks like -

 

log4j.rootLogger=INFO, infolog, errorlog

 

log4j.appender. infolog=org.apache.log4j.RollingFileAppender

log4j.appender. infolog.File=dicom-info.log

log4j.appender. infolog.MaxFileSize=5MB

log4j.appender. infolog.MaxBackupIndex=100

log4j.appender. infolog.layout=org.apache.log4j.PatternLayout

log4j.appender. infolog.layout.ConversionPattern=[%d{dd MMM HH:mm:ss}] [%-p]
(%F:%L) %c - %m%n

 

log4j.appender. errorlog.Threshold=ERROR

log4j.appender. errorlog=org.apache.log4j.RollingFileAppender

log4j.appender. errorlog.File=dicom-error.log

log4j.appender.errorlog.MaxFileSize=5MB

log4j.appender.errorlog.MaxBackupIndex=100

log4j.appender.errorlog.layout=org.apache.log4j.PatternLayout

log4j.appender.errorlog.layout.ConversionPattern=[%d{dd MMM HH:mm:ss}] [%-p]
(%F:%L) %c - %m%n

 

Two log files are getting created.

I want to print the Filename and Line number of the message that's why I
used %F:%L in the conversion pattern.

But this information is not getting printed in the file.

Instead of filename or line number ? is appears in the log file.

 

Can anybody tell me how to get this info in the log file.

 

Thanks


Re: slf4j configuration

by Emmanuel Lecharny :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

arati wrote:

>
> I want to print the Filename and Line number of the message that's why I
> used %F:%L in the conversion pattern.
>
> But this information is not getting printed in the file.
>
> Instead of filename or line number ? is appears in the log file.
>
>  
>
> Can anybody tell me how to get this info in the log file.
>  
It depends on your JVM. Not all JVM can produce such information.

This has nothing to do with MINA or the configuration.

AFAIR, the way traces are being generated is : Log4j generates a
StackTrace, and extract from it all the informations you get in the
logs, including the file name and line number. If the JVM does not
generate those informations while create this stackTrace, you will get
'?' instead.
>  
>
> Thanks
>
>
>  


--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: slf4j configuration

by W.B. Garvelink :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

One thing to check is to make sure you've compiled your code in
debugging mode, if you haven't then the information is outright
unavailable. Another thing to keep in mind is that the runtime
optimization may rewrite methods and/or remove them entirely, so even
if you do get line numbers, they may be inaccurate.

Barend




On Wed, Jun 18, 2008 at 12:21 PM, Emmanuel Lecharny
<elecharny@...> wrote:

> arati wrote:
>>
>> I want to print the Filename and Line number of the message that's why I
>> used %F:%L in the conversion pattern.
>>
>> But this information is not getting printed in the file.
>>
>> Instead of filename or line number ? is appears in the log file.
>>
>>
>> Can anybody tell me how to get this info in the log file.
>>
>
> It depends on your JVM. Not all JVM can produce such information.
>
> This has nothing to do with MINA or the configuration.
>
> AFAIR, the way traces are being generated is : Log4j generates a StackTrace,
> and extract from it all the informations you get in the logs, including the
> file name and line number. If the JVM does not generate those informations
> while create this stackTrace, you will get '?' instead.
>>
>>
>> Thanks
>>
>>
>>
>
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>

RE: slf4j configuration

by arj123 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks guys for your reply.
I think JVM is not the problem as when I run my code from eclipse then it
shows this information for all log messages.

When I run my code from outside eclipse then the MINA LoggerFilter generated
messages also show this information. But the log messages in my code (I have
used slf4j Logger) do not show it.

I have not compiled my code in debugging mode. I am not sure how to do it, I
will try to do it.

Thanks,
Arj
-----Original Message-----
From: W.B. Garvelink [mailto:barend.garvelink@...]
Sent: Wednesday, June 18, 2008 16:42
To: users@...; elecharny@...
Subject: Re: slf4j configuration

One thing to check is to make sure you've compiled your code in
debugging mode, if you haven't then the information is outright
unavailable. Another thing to keep in mind is that the runtime
optimization may rewrite methods and/or remove them entirely, so even
if you do get line numbers, they may be inaccurate.

Barend




On Wed, Jun 18, 2008 at 12:21 PM, Emmanuel Lecharny
<elecharny@...> wrote:

> arati wrote:
>>
>> I want to print the Filename and Line number of the message that's why I
>> used %F:%L in the conversion pattern.
>>
>> But this information is not getting printed in the file.
>>
>> Instead of filename or line number ? is appears in the log file.
>>
>>
>> Can anybody tell me how to get this info in the log file.
>>
>
> It depends on your JVM. Not all JVM can produce such information.
>
> This has nothing to do with MINA or the configuration.
>
> AFAIR, the way traces are being generated is : Log4j generates a
StackTrace,
> and extract from it all the informations you get in the logs, including
the

> file name and line number. If the JVM does not generate those informations
> while create this stackTrace, you will get '?' instead.
>>
>>
>> Thanks
>>
>>
>>
>
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>


RE: slf4j configuration

by arj123 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
You were right Barend.
I compiled it with debugging option and it gave the results as I wanted.

Thanks a lot.
Arj

-----Original Message-----
From: arati [mailto:arati.jadhav@...]
Sent: Friday, June 20, 2008 09:16
To: users@...
Subject: RE: slf4j configuration


Thanks guys for your reply.
I think JVM is not the problem as when I run my code from eclipse then it
shows this information for all log messages.

When I run my code from outside eclipse then the MINA LoggerFilter generated
messages also show this information. But the log messages in my code (I have
used slf4j Logger) do not show it.

I have not compiled my code in debugging mode. I am not sure how to do it, I
will try to do it.

Thanks,
Arj
-----Original Message-----
From: W.B. Garvelink [mailto:barend.garvelink@...]
Sent: Wednesday, June 18, 2008 16:42
To: users@...; elecharny@...
Subject: Re: slf4j configuration

One thing to check is to make sure you've compiled your code in
debugging mode, if you haven't then the information is outright
unavailable. Another thing to keep in mind is that the runtime
optimization may rewrite methods and/or remove them entirely, so even
if you do get line numbers, they may be inaccurate.

Barend




On Wed, Jun 18, 2008 at 12:21 PM, Emmanuel Lecharny
<elecharny@...> wrote:

> arati wrote:
>>
>> I want to print the Filename and Line number of the message that's why I
>> used %F:%L in the conversion pattern.
>>
>> But this information is not getting printed in the file.
>>
>> Instead of filename or line number ? is appears in the log file.
>>
>>
>> Can anybody tell me how to get this info in the log file.
>>
>
> It depends on your JVM. Not all JVM can produce such information.
>
> This has nothing to do with MINA or the configuration.
>
> AFAIR, the way traces are being generated is : Log4j generates a
StackTrace,
> and extract from it all the informations you get in the logs, including
the

> file name and line number. If the JVM does not generate those informations
> while create this stackTrace, you will get '?' instead.
>>
>>
>> Thanks
>>
>>
>>
>
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>


RE: Too many open files

by Arv Mistry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
Hi,

Are there any known issues with Mina 2.0, leaving too many open file
descriptors?

I have simplified my client, so all I do is connect to a server and
disconnect (i.e. call close() on session .
This is triggered by command line input so that I can control it.

I find when I do a lsof -p <pid> | wc -l following the
connect/disconnect, that the number goes up by 20 each time and stays
up. I'm not familiar with TCP at that low a level but it seems to be the
pipe/eventpoll instances that arent cleaned up.

Any insight would be appreciated.

Cheers Arv


Re: Too many open files

by Niklas Gustavsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jul 4, 2008 at 10:05 PM, Arv Mistry <arv@...> wrote:

> Are there any known issues with Mina 2.0, leaving too many open file
> descriptors?
>
> I have simplified my client, so all I do is connect to a server and
> disconnect (i.e. call close() on session .
> This is triggered by command line input so that I can control it.
>
> I find when I do a lsof -p <pid> | wc -l following the
> connect/disconnect, that the number goes up by 20 each time and stays
> up. I'm not familiar with TCP at that low a level but it seems to be the
> pipe/eventpoll instances that arent cleaned up.

If you do a netstat -a do you see sockets on your port, if so, what
state are they in?

/niklas

RE: Too many open files

by Arv Mistry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
Niklas,

I see, on the server side the port is in the LISTEN state and when I
connect my client, the port is in the state ESTABLISHED, this then is
removed when I disconnect. I think that's all correct.

But when I do a lsof -p <pid> | wc -l it appears not all the services
are cleaned up i.e. there are a lot of eventpoll and socket instances.

I must be not cleaning up properly;

  I'm using NioSocketConnector().connect to connect to the client. I get
the session from the ConnectFuture that that returns. I then call the
close() on  this when disconnecting.

 Am I missing something? Do I need to call the dispose() on the
NioSocketConnetor also?
 
 Thanks again.

Cheers Arv


-----Original Message-----
From: Niklas Gustavsson [mailto:niklas@...]
Sent: Saturday, July 05, 2008 12:34 PM
To: users@...
Subject: Re: Too many open files

On Fri, Jul 4, 2008 at 10:05 PM, Arv Mistry <arv@...> wrote:

> Are there any known issues with Mina 2.0, leaving too many open file
> descriptors?
>
> I have simplified my client, so all I do is connect to a server and
> disconnect (i.e. call close() on session .
> This is triggered by command line input so that I can control it.
>
> I find when I do a lsof -p <pid> | wc -l following the
> connect/disconnect, that the number goes up by 20 each time and stays
> up. I'm not familiar with TCP at that low a level but it seems to be
> the pipe/eventpoll instances that arent cleaned up.

If you do a netstat -a do you see sockets on your port, if so, what
state are they in?

/niklas

Re: Too many open files

by Tuure Laurinolli-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Arv Mistry wrote:

> I have simplified my client, so all I do is connect to a server and
> disconnect (i.e. call close() on session .
> This is triggered by command line input so that I can control it.

Do you create a new Connector for each session? Do you call dispose() on
IoConnectors you no longer use?

> I find when I do a lsof -p <pid> | wc -l following the
> connect/disconnect, that the number goes up by 20 each time and stays
> up. I'm not familiar with TCP at that low a level but it seems to be the
> pipe/eventpoll instances that arent cleaned up.

This sounds like you are leaking Connectors, at least if you are using NIO.

RE: Too many open files

by Arv Mistry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 
Thanks folks, that's makes more sense, so you can have multiple services
on one connection.
Cleanup the services via the dispose() and cleanup the connection via
close()

Cheers Arv

-----Original Message-----
From: Arv Mistry [mailto:arv@...]
Sent: Monday, July 07, 2008 11:41 AM
To: users@...
Subject: RE: Too many open files

 
Niklas,

I see, on the server side the port is in the LISTEN state and when I
connect my client, the port is in the state ESTABLISHED, this then is
removed when I disconnect. I think that's all correct.

But when I do a lsof -p <pid> | wc -l it appears not all the services
are cleaned up i.e. there are a lot of eventpoll and socket instances.

I must be not cleaning up properly;

  I'm using NioSocketConnector().connect to connect to the client. I get
the session from the ConnectFuture that that returns. I then call the
close() on  this when disconnecting.

 Am I missing something? Do I need to call the dispose() on the
NioSocketConnetor also?
 
 Thanks again.

Cheers Arv


-----Original Message-----
From: Niklas Gustavsson [mailto:niklas@...]
Sent: Saturday, July 05, 2008 12:34 PM
To: users@...
Subject: Re: Too many open files

On Fri, Jul 4, 2008 at 10:05 PM, Arv Mistry <arv@...> wrote:

> Are there any known issues with Mina 2.0, leaving too many open file
> descriptors?
>
> I have simplified my client, so all I do is connect to a server and
> disconnect (i.e. call close() on session .
> This is triggered by command line input so that I can control it.
>
> I find when I do a lsof -p <pid> | wc -l following the
> connect/disconnect, that the number goes up by 20 each time and stays
> up. I'm not familiar with TCP at that low a level but it seems to be
> the pipe/eventpoll instances that arent cleaned up.

If you do a netstat -a do you see sockets on your port, if so, what
state are they in?

/niklas