Results 1 to 5 of 5
  1. #1
    stim644 is offline Member
    Join Date
    Jun 2015
    Posts
    2
    Rep Power
    0

    Default Question in log4j Listener

    Hello!
    My question - Me need listener which be execute when create new file in log4j. It exist ?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Question in log4j Listener

    Probably not. Logging is not specific to files, that is simply one of many output formats of a log. It might also simply be sent to the System console, to system memory or to an internet socket.

    Why exactly do you need to know when the file is created? Perhaps there is another way.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    stim644 is offline Member
    Join Date
    Jun 2015
    Posts
    2
    Rep Power
    0

    Default Re: Question in log4j Listener

    Quote Originally Posted by gimbal2 View Post
    Probably not. Logging is not specific to files, that is simply one of many output formats of a log. It might also simply be sent to the System console, to system memory or to an internet socket.

    Why exactly do you need to know when the file is created? Perhaps there is another way.
    Need output in every new file in beginning file system info about system.

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,991
    Rep Power
    8

    Default Re: Question in log4j Listener

    You'll probably want to subclass org.apache.log4j.FileAppender and override the correct method. Download the sources of Log4J and go dive in the inner bowels.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Question in log4j Listener

    Basically we're talking about a file header. So maybe something like this:

    Inserting Header Text in Log file - Log4j (Frameworks forum at JavaRanch)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Log4j Logger question
    By jakSun8 in forum New To Java
    Replies: 4
    Last Post: 03-24-2012, 08:41 PM
  2. Log4j Level question
    By Bearded_Bear in forum New To Java
    Replies: 1
    Last Post: 02-08-2011, 03:38 PM
  3. log4j RollingFileAppender question
    By vasanthj in forum Advanced Java
    Replies: 2
    Last Post: 01-12-2011, 04:38 PM
  4. log4j RollingFileAppender question
    By vasanthj in forum Advanced Java
    Replies: 0
    Last Post: 12-07-2010, 08:07 PM
  5. Log4J Question <moved>
    By razorSpirit in forum New To Java
    Replies: 2
    Last Post: 10-13-2010, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •