Python logging and ThreadingTCPServer

Discussion in 'Python' started by Daniel, Oct 17, 2008.

  1. Daniel

    Daniel Guest

    Hello,

    I building an application that consists of several sockets
    components. I would like to use logging in them, but I've noticed
    some issues with the logs getting mangled. This mangling seems to
    happen when different threads attempt to access the same log file.

    For example, if a client and a server component are running on the
    same box and both try to write to the same physical log file, the
    first will write fine, but when the second thread (or process) writes
    to the log file it mangles the first part of the log file including
    deleting some of the information and adding various strange characters
    and space. Sometimes it seems that the first process never is able to
    write to the log file after the second process starts writing.

    Is this a known issue/bug? Are there any known workarounds?

    Thanks,
    Daniel
     
    Daniel, Oct 17, 2008
    #1
    1. Advertising

  2. Daniel

    Vinay Sajip Guest

    On Oct 17, 5:48 pm, Daniel <> wrote:
    > Hello,
    >
    > I building an application that consists of several sockets
    > components. I would like to useloggingin them, but I've noticed
    > some issues with the logs getting mangled. This mangling seems to
    > happen when different threads attempt to access the same log file.
    >
    > For example, if a client and a server component are running on the
    > same box and both try to write to the same physical log file, the
    > first will write fine, but when the second thread (or process) writes
    > to the log file it mangles the first part of the log file including
    > deleting some of the information and adding various strange characters
    > and space. Sometimes it seems that the first process never is able to
    > write to the log file after the second process starts writing.
    >
    > Is this a known issue/bug? Are there any known workarounds?
    >
    > Thanks,
    > Daniel


    This has come up before. See for example

    http://groups.google.com/group/comp.lang.python/browse_thread/thread/3fbd36c89119f27f

    Regards,

    Vinay Sajip
     
    Vinay Sajip, Oct 18, 2008
    #2
    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. UrgeOverkill
    Replies:
    2
    Views:
    458
    Peter Hansen
    Feb 19, 2004
  2. Dustin
    Replies:
    2
    Views:
    1,066
    G. S. Hayes
    Aug 9, 2004
  3. Stuart D. Gathman

    Debugging SocketServer.ThreadingTCPServer

    Stuart D. Gathman, Jan 16, 2007, in forum: Python
    Replies:
    0
    Views:
    337
    Stuart D. Gathman
    Jan 16, 2007
  4. Jean-Paul Calderone

    Re: Debugging SocketServer.ThreadingTCPServer

    Jean-Paul Calderone, Jan 16, 2007, in forum: Python
    Replies:
    2
    Views:
    395
    R. Bernstein
    Feb 4, 2007
  5. Brad Brock
    Replies:
    0
    Views:
    347
    Brad Brock
    May 19, 2007
Loading...

Share This Page