Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: issue with logging!!

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default issue with logging!!

    I have a java class that should generate .csv file named qcCoverageReport.csv and store the test results. But my java class is generating the file but not storing the log. Where have I done the mistake? This is my log4j.properties file:

    log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
    log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
    log4j.appender.stdout.layout.ConversionPattern =%d{ABSOLUTE} %5p %c{1}:%L - %m%n
    log4j.appender.stdout=org.apache.log4j.DailyRollin gFileAppender
    log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
    log4j.appender.stdout.layout.ConversionPattern =%5p (%F:%L) [%d] - %m%n
    log4j.appender.stdout.File=C:\\junit\\qcCoverageRe port.csv
    log4j.rootLogger=INFO, stdout


  2. #2
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default Re: issue with logging!!

    Could you post the code ?

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: issue with logging!!

    This is my method:

    private void printQCTestCaseCoverage() {

    try {
    FileAppender appender = new FileAppender(new PatternLayout(), "qcCoverageReport.csv", true);
    appender.setFile("qcCoveragereport.csv");
    log.addAppender(appender);
    Class clazz = Class.forName(this.getClass().getName());
    @SuppressWarnings("unchecked")
    Method method = clazz.getMethod(testName.getMethodName());
    if (method.isAnnotationPresent(QCTestCases.class)) {
    log.info("Class [" + clazz.getName() + "] test method [" + method.getName() + "].");
    QCTestCases qcTestCases = method.getAnnotation(QCTestCases.class);
    for (String element : qcTestCases.name()) {
    log.info("QC Test Cases Covered [" + element.toString() + "].");
    }
    }
    } catch (Throwable t) {
    t.printStackTrace(System.err);
    }
    }

  4. #4
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default Re: issue with logging!!

    for a start.. Try to put in a few System.out.println()'s .. to check the value of every variable in that method.

    EDIT: Make sure that they are printing out the correct details your after.

  5. #5
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: issue with logging!!

    log4j.appender.stdout.File=C:\\junit\\qcCoverageRe port.csv
    Is this the space between qcCoverageRe and port.csv?

    What you want it do?

  6. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: issue with logging!!

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/51988-issue-logging.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


Similar Threads

  1. not sure what the issue is here
    By Tfence in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 28th, 2011, 02:18 AM
  2. Crawler has trouble logging in.
    By bholzer in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 13th, 2011, 06:59 PM
  3. [SOLVED] if statement issue
    By Elementality in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 17th, 2011, 03:29 PM
  4. Java: Handling cookies when logging in with POST
    By cloakbot in forum What's Wrong With My Code?
    Replies: 0
    Last Post: June 16th, 2010, 04:31 PM
  5. problem of logging in ejb3
    By mousumi in forum Enterprise JavaBeans
    Replies: 2
    Last Post: February 1st, 2010, 06:35 AM