slf4j configuration - Apache

This is a discussion on slf4j configuration - Apache ; 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 - ...

+ Reply to Thread
Results 1 to 10 of 10

slf4j configuration

  1. Default slf4j configuration

    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



  2. Default Re: slf4j configuration

    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




  3. Default 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@apache.org> 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
    >
    >
    >


  4. Default 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
    Sent: Wednesday, June 18, 2008 16:42
    To: users-KkkZOr9CKukPKjDvHGQMeg@public.gmane.org; elecharny-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org
    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-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org> 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
    >
    >
    >




  5. Default RE: slf4j configuration

    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-EiYIHYenCd1BDgjK7y7TUQ@public.gmane.org]
    Sent: Friday, June 20, 2008 09:16
    To: users-KkkZOr9CKukPKjDvHGQMeg@public.gmane.org
    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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
    Sent: Wednesday, June 18, 2008 16:42
    To: users-KkkZOr9CKukPKjDvHGQMeg@public.gmane.org; elecharny-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org
    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-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org> 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
    >
    >
    >




  6. Default RE: Too many open files


    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



  7. Default Re: Too many open files

    On Fri, Jul 4, 2008 at 10:05 PM, Arv Mistry <arv-boZml1jkjx8eIZ0/mPfg9Q@public.gmane.org> 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


  8. Default 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-/fzFv00SCG0NZ+ppGFcyYQ@public.gmane.org]
    Sent: Saturday, July 05, 2008 12:34 PM
    To: users-KkkZOr9CKukPKjDvHGQMeg@public.gmane.org
    Subject: Re: Too many open files

    On Fri, Jul 4, 2008 at 10:05 PM, Arv Mistry <arv-boZml1jkjx8eIZ0/mPfg9Q@public.gmane.org> 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


  9. Default Re: Too many open files

    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.


  10. Default RE: Too many open files


    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-boZml1jkjx8eIZ0/mPfg9Q@public.gmane.org]
    Sent: Monday, July 07, 2008 11:41 AM
    To: users-KkkZOr9CKukPKjDvHGQMeg@public.gmane.org
    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-/fzFv00SCG0NZ+ppGFcyYQ@public.gmane.org]
    Sent: Saturday, July 05, 2008 12:34 PM
    To: users-KkkZOr9CKukPKjDvHGQMeg@public.gmane.org
    Subject: Re: Too many open files

    On Fri, Jul 4, 2008 at 10:05 PM, Arv Mistry <arv-boZml1jkjx8eIZ0/mPfg9Q@public.gmane.org> 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


+ Reply to Thread