Java Log Coverage Tool

Are there any tools or strategies for creating a Coverage Log report (Java, log4j)? Like code coverage, but ensuring that there are no great methods, classes, or packages that write nothing.

When coding web services, my team does not write a lot of journal reports. When debugging problems in real time with launch, production code, we always wanted to have it. Inevitably, we try to reproduce the error in our test environment with the addition of a debugger or the addition of additional log statements, which can be very difficult depending on the structure and interaction.

Does anyone use this as an indicator of code quality?

+5
source share
2 answers

, , - . , , ( " - ?" ) ( " , ?" ).

script, . , , Perl. , SLF4J, "LoggerFactory" , .

while ($filename = shift) {
    open my $in, "<$filename";
    my $loc = 0;
    my $log = "NO LOGGER";
    while (<$in>) {
        $loc++;
        if (m/import org.slf4j.LoggerFactory/) {
            $log = "has logger";
        }
    }
    print "$filename : $loc LOC $log\n";
    $total{$log} += $loc;
}
print "\n\nTOTAL LOGGED: $total{'has logger'}\nTOTAL UNLOGGED: $total{'NO LOGGER'}\n";

, Java

$ find . -name \*.java -exec perl haslog.pm {} \+

, , , .

+1

, , . , , /. . , , , , , , . , . , .

, , - , (, -, ), , . , , . RuntimeExceptions , , , . , /.

0

All Articles