Results 1 to 2 of 2
  1. #1
    fred is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default Problems using log4j

    I want to use log4j but I have problems
    My file log4j.properties:
    Java Code:
    
    log4j.rootCategory=WARN, C
    
    
    log4j.appender.C=org.apache.log4j.ConsoleAppender
    log4j.appender.C.layout=org.apache.log4j.PatternLayout
    log4j.appender.C.layout.ConversionPattern=%-5p [%-24d] - %c.%m%n
    
    #Appender sobre archivo (FileAppender)
    log4j.appender.F=org.apache.log4j.FileAppender
    log4j.appender.F.File=C:/service8.log
    log4j.appender.F.layout=org.apache.log4j.PatternLayout
    log4j.appender.F.layout.ConversionPattern=%-5p [%-24d] - %c.%m%n
    my code:
    Java Code:
    static Logger log = Logger.getLogger(User.class);
    
    log.error("error in …");
    in console appears "error in..." but it doesn't generate the file.
    what's the problem ?
    thanks in advance

  2. #2
    katie is offline Member
    Join Date
    Jul 2007
    Posts
    41
    Rep Power
    0

    Default

    write
    Java Code:
    log4j.rootLogger = WARN, C, F
    instead of:
    Java Code:
    log4j.rootCategory=WARN, C
    good luck

Similar Threads

  1. log4j
    By swapna_d in forum New To Java
    Replies: 7
    Last Post: 08-04-2010, 01:23 AM
  2. Regarding Log4j
    By sidiq in forum New To Java
    Replies: 0
    Last Post: 04-07-2008, 08:35 PM
  3. log4j with Applet
    By sunjavaboy in forum Java Applets
    Replies: 0
    Last Post: 03-25-2008, 01:13 AM
  4. Log4j
    By chakri in forum New To Java
    Replies: 1
    Last Post: 02-08-2008, 11:15 PM
  5. Log4J - transactions log
    By Daniel in forum Advanced Java
    Replies: 1
    Last Post: 06-05-2007, 06:54 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
  •