src/main/java/pityoulish/logutil/LogConfig.java
public static void configure(Class cls)
    throws Exception //@@@ really?
  {
    String configname = System.getProperty(LOGGING_PROPERTY_NAME,
                                           LOGGING_PROPERTY_DEFAULT);
    if ((configname == null) || "".equals(configname))
       return;

    InputStream cfgstream = null;
    try {
      if (configname.indexOf(".") < 0)
       {
         // search for a bundled properties file
         configname = "logconfig." + configname + ".properties";

         if (cls != null)
            cfgstream = cls.getResourceAsStream(configname);
         if (cfgstream == null)
            cfgstream = LogConfig.class.getResourceAsStream(configname);
       }
      else
       {
         System.out.println("@@@ logging config file: "+configname);
         // read the properties from the file system
         cfgstream = new FileInputStream(configname);
       }

      if (cfgstream != null)
         LogManager.getLogManager().readConfiguration(cfgstream);
      else System.out.println("@@@ logging config not found");

      //@@@ what to do about an exception? log? let pass?
    } finally {
      if (cfgstream != null)
         cfgstream.close();
    }

  }
/**
   * Configures logging, if applicable.
   *
   * @param cls   the class near which to search for bundled properties,
   *              or <code>null</code>
   *
   * @throws Exception   in case of a problem
   */
Configures logging, if applicable.
@param cls   the class near which to search for bundled properties,
or null

@throws Exception   in case of a problem
Configures logging if applicable . @param cls the class near which to search for bundled properties or null @throws Exception in case of a problem
public static void configure(Class cls)
    throws Exception 
  {
    String configname = System.getProperty(LOGGING_PROPERTY_NAME,
                                           LOGGING_PROPERTY_DEFAULT);
    if ((configname == null) || "".equals(configname))
       return;
    InputStream cfgstream = null;
    try {
      if (configname.indexOf(".") < 0)
       {
         configname = "logconfig." + configname + ".properties";
         if (cls != null)
            cfgstream = cls.getResourceAsStream(configname);
         if (cfgstream == null)
            cfgstream = LogConfig.class.getResourceAsStream(configname);
       }
      else
       {
         System.out.println("@@@ logging config file: "+configname);
         cfgstream = new FileInputStream(configname);
       }
      if (cfgstream != null)
         LogManager.getLogManager().readConfiguration(cfgstream);
      else System.out.println("@@@ logging config not found");
    } finally {
      if (cfgstream != null)
         cfgstream.close();
    }
  }
public static void configure ( Class cls ) throws Exception { String configname = System . getProperty ( LOGGING_PROPERTY_NAME , LOGGING_PROPERTY_DEFAULT ) ; if ( ( configname == null ) || "" . equals ( configname ) ) return ; InputStream cfgstream = null ; try { if ( configname . indexOf ( "." ) < 0 ) { configname = "logconfig." + configname + ".properties" ; if ( cls != null ) cfgstream = cls . getResourceAsStream ( configname ) ; if ( cfgstream == null ) cfgstream = LogConfig . class . getResourceAsStream ( configname ) ; } else { System . out . println ( "@@@ logging config file: " + configname ) ; cfgstream = new FileInputStream ( configname ) ; } if ( cfgstream != null ) LogManager . getLogManager ( ) . readConfiguration ( cfgstream ) ; else System . out . println ( "@@@ logging config not found" ) ; } finally { if ( cfgstream != null ) cfgstream . close ( ) ; } }
Configures logging, if applicable.
Configures logging if applicable .
//@@@ really? // search for a bundled properties file // read the properties from the file system //@@@ what to do about an exception? log? let pass?