Results 1 to 3 of 3
  1. #1
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default console appender to a text file

    Hi Folks,

    i am having one opensource application that writes its log file to the console.

    I would like to store it(the console output) in a text file.

    Here is the code snippet of log4j.properties file:

    # The console appender
    log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder

    # The console appender layout
    log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
    log4j.appender.stdout.layout.ConversionPattern=${l ayout.medium}
    ..can anybody help me in this please...

  2. #2
    devunion is offline Member
    Join Date
    Jun 2008
    Posts
    56
    Rep Power
    0

    Default

    I'm using the next code:

    Java Code:
    log4j.rootLogger=DEBUG, console, rollingfile,
    
    ..............................................
    
    log4j.appender.rollingfile=org.apache.log4j.RollingFileAppender
    log4j.appender.rollingfile.layout=org.apache.log4j.PatternLayout
    log4j.appender.rollingfile.layout.ConversionPattern=%5p: %d{HH:mm:ss,SSS} [%t] (%c) - %m%n
    log4j.appender.rollingfile.File=core.log
    log4j.appender.rollingfile.MaxFileSize=1MB
    log4j.appender.rollingfile.MaxBackupIndex=1
    Try Controls4J - Advanced Swing Components.

  3. #3
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Redirect STDOUT to the file you want. You can do this in Java via (java.lang.System) or at the console when you call the application.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

Similar Threads

  1. count character in text file as input file
    By aNNuur in forum New To Java
    Replies: 7
    Last Post: 03-25-2010, 04:01 PM
  2. Saving Console content to a file
    By puk284 in forum Advanced Java
    Replies: 2
    Last Post: 05-07-2009, 05:58 AM
  3. find and replace text from a text file
    By gezzel in forum New To Java
    Replies: 2
    Last Post: 09-19-2008, 04:04 PM
  4. How to read a text file from a Java Archive File
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-08-2008, 09:13 AM
  5. Replies: 1
    Last Post: 07-24-2007, 02:02 AM

Posting Permissions

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