Skip to content

Commit

Permalink
added config file for anything using java.util.logging (closes #30)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodnaph committed May 1, 2011
1 parent c8eba76 commit 5a66053
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions dist-files/log/javalogging.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.jaudiotagger.level=WARNING
22 changes: 22 additions & 0 deletions src/com/pugh/sockso/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.InputStream;

import joptsimple.OptionParser;
import joptsimple.OptionSet;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import java.util.logging.LogManager;

public class Main {

private static final Logger log = Logger.getLogger( Main.class );
Expand Down Expand Up @@ -74,6 +78,7 @@ public static void main( final String[] args ) throws Exception{
Runtime.getRuntime().addShutdownHook( new Shutdown() );

initLogger( getLogPropsFile("default") );
initJavaLogger();

//
// do initial setup, we're gonna need to parse the command line
Expand Down Expand Up @@ -631,5 +636,22 @@ private static void initLogger( final String propsFile ) {
PropertyConfigurator.configure( propsFile );

}

/**
* Inits loggers using java.util.logging
*
*/

private static void initJavaLogger() throws IOException {

final String propsFile = "log/javalogging.properties";
final InputStream is = new FileInputStream( new File(propsFile) );

LogManager.getLogManager()
.readConfiguration( is );

Utils.close( is );

}

}

1 comment on commit 5a66053

@rgngl
Copy link
Contributor

@rgngl rgngl commented on 5a66053 May 1, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks.

Please sign in to comment.