Log4j disk access or queue

Discussion in 'Java' started by Philippe Godin, Feb 25, 2004.

  1. Good day,

    The client requirements indicates that the logging of messages shall
    be done physically (write to disk) ONLY every 10 seconds or when 100
    log messages are pending. Understand the ONLY word clearly, the
    application we're building is to run on a custom board that uses a 1GB
    compact flash card as the rom. The information that is to be kept on
    the card is really CRUCIAL. There's a lot of computation involve and
    write to disk shall be reduced to a minimum. Is there a way to use
    log4j to do so. I've checked the documentation and couldn't find
    anything that realized that. I would first need something like a log
    queue and find a way to manage the physical access to disk. I could
    create the classes that would accomplish this but just wanted to make
    sure log4j doesn't already handle this. BTW, we have to be using a
    RollingFile of 100MB (probably 10 times 10MB)

    Any idea??
    thx, Flip
    Philippe Godin, Feb 25, 2004
    #1
    1. Advertising

  2. Philippe Godin

    Oscar kind Guest

    Philippe Godin <> wrote:
    > The client requirements indicates that the logging of messages shall
    > be done physically (write to disk) ONLY every 10 seconds or when 100
    > log messages are pending. Understand the ONLY word clearly, the
    > application we're building is to run on a custom board that uses a 1GB
    > compact flash card as the rom. The information that is to be kept on
    > the card is really CRUCIAL. There's a lot of computation involve and
    > write to disk shall be reduced to a minimum. Is there a way to use
    > log4j to do so. I've checked the documentation and couldn't find
    > anything that realized that. I would first need something like a log
    > queue and find a way to manage the physical access to disk. I could
    > create the classes that would accomplish this but just wanted to make
    > sure log4j doesn't already handle this. BTW, we have to be using a
    > RollingFile of 100MB (probably 10 times 10MB)


    You cannot use log4j directly, but you can either:
    - Create a service that listens on a socket and writes all messages
    conform the requirements. Use log4j to log to the socket.
    - Create your own subclass of (Rolling)FileAppender that writes the
    messages according to the requirements.


    Oscar

    --
    Oscar Kind http://home.hccnet.nl/okind/
    Java/J2EE Developer email available on website
    Oscar kind, Feb 26, 2004
    #2
    1. Advertising

  3. Thx Oscar for your time and patience,

    I met the client requirements by creating a new class that is pretty
    much like the AsynchAppender. It handles the management of all
    appenders and put new log events into the boundedFIFO list. Upon log
    event reception by this new class, a check is made to ensure that the
    maximum load hasn't been reached. In our case it's 100. If so, the
    list is flushed to all registered appenders for immediate processing.
    Otherwise the event is appended to the list. I've modified the
    Dispatcher to make it sleep for 10 seconds. Every time it runs, it
    flushes the content of the list to all registered appenders no matter
    how many events are in there.

    Philippe Godin

    Oscar kind <> wrote in message news:<403ddeb7$0$12851$>...
    > Philippe Godin <> wrote:
    > > The client requirements indicates that the logging of messages shall
    > > be done physically (write to disk) ONLY every 10 seconds or when 100
    > > log messages are pending. Understand the ONLY word clearly, the
    > > application we're building is to run on a custom board that uses a 1GB
    > > compact flash card as the rom. The information that is to be kept on
    > > the card is really CRUCIAL. There's a lot of computation involve and
    > > write to disk shall be reduced to a minimum. Is there a way to use
    > > log4j to do so. I've checked the documentation and couldn't find
    > > anything that realized that. I would first need something like a log
    > > queue and find a way to manage the physical access to disk. I could
    > > create the classes that would accomplish this but just wanted to make
    > > sure log4j doesn't already handle this. BTW, we have to be using a
    > > RollingFile of 100MB (probably 10 times 10MB)

    >
    > You cannot use log4j directly, but you can either:
    > - Create a service that listens on a socket and writes all messages
    > conform the requirements. Use log4j to log to the socket.
    > - Create your own subclass of (Rolling)FileAppender that writes the
    > messages according to the requirements.
    >
    >
    > Oscar
    Philippe Godin, Feb 27, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,773
    Alexandra Stehman
    Jan 19, 2004
  2. Alex Hunsley
    Replies:
    2
    Views:
    12,935
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  3. Rodolfo
    Replies:
    0
    Views:
    953
    Rodolfo
    Jul 12, 2004
  4. Russell Warren

    Is Queue.Queue.queue.clear() thread-safe?

    Russell Warren, Jun 22, 2006, in forum: Python
    Replies:
    4
    Views:
    681
    Russell Warren
    Jun 27, 2006
  5. Kris
    Replies:
    0
    Views:
    479
Loading...

Share This Page