Tabnine Logo
PropertyConfigurator.configure
Code IndexAdd Tabnine to your IDE (free)

How to use
configure
method
in
org.apache.log4j.PropertyConfigurator

Best Java code snippets using org.apache.log4j.PropertyConfigurator.configure (Showing top 20 results out of 2,097)

origin: log4j/log4j

/** initialise log4j **/
private static void initLog4J() {
  final Properties props = new Properties();
  props.setProperty("log4j.rootLogger", "DEBUG, A1");
  props.setProperty("log4j.appender.A1",
           "org.apache.log4j.ConsoleAppender");
  props.setProperty("log4j.appender.A1.layout",
           "org.apache.log4j.TTCCLayout");
  PropertyConfigurator.configure(props);
}
origin: log4j/log4j

/**
 * This method configures the <code>LF5Appender</code> using a
 * default configuration file. The default configuration file is
 * <bold>defaultconfig.properties</bold>.
 * @throws java.io.IOException
 */
public static void configure() throws IOException {
 String resource =
   "/org/apache/log4j/lf5/config/defaultconfig.properties";
 URL configFileResource =
   DefaultLF5Configurator.class.getResource(resource);
 if (configFileResource != null) {
  PropertyConfigurator.configure(configFileResource);
 } else {
  throw new IOException("Error: Unable to open the resource" +
    resource);
 }
}
origin: dieforfree/qart4j

  private static void configLog(String configFile) {
    if(new File(configFile).exists()) {
      PropertyConfigurator.configure(configFile);
      return;
    }

    Properties properties = new Properties();

    properties.setProperty("log4j.rootLogger", "DEBUG, CA");
    properties.setProperty("log4j.appender.CA", "org.apache.log4j.ConsoleAppender");
    properties.setProperty("log4j.appender.CA.layout", "org.apache.log4j.PatternLayout");
    properties.setProperty("log4j.appender.CA.layout.ConversionPattern", "%d{yyyy-MM-dd HH:mm:ss.SSS} %-4r [%t] %-5p %c %x - %m%n");
    PropertyConfigurator.configure(properties);
  }
}
origin: log4j/log4j

 static void init(String portStr, String configFile) {
  try {
   port = Integer.parseInt(portStr);
  } catch(java.lang.NumberFormatException e) {
   e.printStackTrace();
   usage("Could not interpret port number ["+ portStr +"].");
  }
    if(configFile.endsWith(".xml")) {
   DOMConfigurator.configure(configFile);
  } else {
   PropertyConfigurator.configure(configFile);
  }
 }
}
origin: log4j/log4j

static
void init(String portStr, String configFile, String dirStr) {
 try {
  port = Integer.parseInt(portStr);
 }
 catch(java.lang.NumberFormatException e) {
  e.printStackTrace();
  usage("Could not interpret port number ["+ portStr +"].");
 }
 PropertyConfigurator.configure(configFile);
 File dir = new File(dirStr);
 if(!dir.isDirectory()) {
  usage("["+dirStr+"] is not a directory.");
 }
 server = new SocketServer(dir);
}
origin: alibaba/jstorm

  public static void updateLog4jConfiguration(Class<?> targetClass,
                        String log4jPath) throws Exception {
    Properties customProperties = new Properties();
    FileInputStream fs = null;
    InputStream is = null;
    try {
      fs = new FileInputStream(log4jPath);
      is = targetClass.getResourceAsStream("/log4j.properties");
      customProperties.load(fs);
      Properties originalProperties = new Properties();
      originalProperties.load(is);
      for (Entry<Object, Object> entry : customProperties.entrySet()) {
        originalProperties.setProperty(entry.getKey().toString(), entry
            .getValue().toString());
      }
      LogManager.resetConfiguration();
      PropertyConfigurator.configure(originalProperties);
    }finally {
      IOUtils.closeQuietly(is);
      IOUtils.closeQuietly(fs);
    }
  }
}
origin: log4j/log4j

 DOMConfigurator.configure(configFile);
} else {
 PropertyConfigurator.configure(configFile);
origin: h2oai/h2o-2

private static org.apache.log4j.Logger createLog4jLogger(String logDirParent) {
 synchronized (water.util.Log.class) {
  if (_logger != null) {
   return _logger;
  }
  // If a log4j properties file was specified on the command-line, use it.
  // Otherwise, create some default properties on the fly.
  String log4jProperties = System.getProperty ("log4j.properties");
  if (log4jProperties != null) {
   PropertyConfigurator.configure(log4jProperties);
   // TODO:  Need some way to set LOG_DIR here for LogCollectorTask to work.
  }
  else {
   java.util.Properties p = new java.util.Properties();
   setLog4jProperties(logDirParent, p);
   PropertyConfigurator.configure(p);
  }
  _logger = LogManager.getLogger(Log.class.getName());
 }
 return _logger;
}
origin: RipMeApp/ripme

/**
 * Configures root logger, either for FILE output or just console.
 */
public static void configureLogger() {
  LogManager.shutdown();
  String logFile = getConfigBoolean("log.save", false) ? "log4j.file.properties" : "log4j.properties";
  try (InputStream stream = Utils.class.getClassLoader().getResourceAsStream(logFile)) {
    if (stream == null) {
      PropertyConfigurator.configure("src/main/resources/" + logFile);
    } else {
      PropertyConfigurator.configure(stream);
    }
    LOGGER.info("Loaded " + logFile);
  } catch (IOException e) {
    LOGGER.error(e.getMessage(), e);
  }
}
origin: apache/incubator-dubbo

properties.setProperty("log4j.appender.application.layout", "org.apache.log4j.PatternLayout");
properties.setProperty("log4j.appender.application.layout.ConversionPattern", "%d [%t] %-5p %C{6} (%F:%L) - %m%n");
PropertyConfigurator.configure(properties);
origin: apache/incubator-dubbo

properties.setProperty("log4j.appender.application.layout", "org.apache.log4j.PatternLayout");
properties.setProperty("log4j.appender.application.layout.ConversionPattern", "%d [%t] %-5p %C{6} (%F:%L) - %m%n");
PropertyConfigurator.configure(properties);
origin: apache/incubator-gobblin

 /**
  * Update the log4j configuration.
  *
  * @param targetClass the target class used to get the original log4j configuration file as a resource
  * @param log4jFileName the custom log4j configuration properties file name
  * @throws IOException if there's something wrong with updating the log4j configuration
  */
 public static void updateLog4jConfiguration(Class<?> targetClass, String log4jFileName)
   throws IOException {
  final Closer closer = Closer.create();
  try {
   final InputStream inputStream = closer.register(targetClass.getResourceAsStream("/" + log4jFileName));
   final Properties originalProperties = new Properties();
   originalProperties.load(inputStream);

   LogManager.resetConfiguration();
   PropertyConfigurator.configure(originalProperties);
  } catch (Throwable t) {
   throw closer.rethrow(t);
  } finally {
   closer.close();
  }
 }
}
origin: apache/incubator-gobblin

 PropertyConfigurator.configure(originalProperties);
} catch (Throwable t) {
 throw closer.rethrow(t);
origin: marytts/marytts

  logprops.setProperty(loggerMaryttsKey, loggerMaryttsValue);
PropertyConfigurator.configure(logprops);
origin: marytts/marytts

  logprops.setProperty(loggerMaryttsKey, loggerMaryttsValue);
PropertyConfigurator.configure(logprops);
origin: geoserver/geoserver

LogManager.resetConfiguration();
PropertyConfigurator.configure(lprops);
    PropertyConfigurator.configure(lprops);
    LoggingInitializer.LOGGER.fine("Logging output to file '" + logFileName + "'");
  } else if (gslf != null) {
origin: ltsopensource/light-task-scheduler

PropertyConfigurator.configure(log4jPath);
origin: ltsopensource/light-task-scheduler

PropertyConfigurator.configure(log4jPath);
origin: ltsopensource/light-task-scheduler

PropertyConfigurator.configure(log4jPath);
origin: ltsopensource/light-task-scheduler

PropertyConfigurator.configure(log4jPath);
org.apache.log4jPropertyConfiguratorconfigure

Javadoc

Reads configuration options from an InputStream.

Popular methods of PropertyConfigurator

  • configureAndWatch
    Read the configuration file configFilename if it exists. Moreover, a thread will be created that wil
  • <init>
  • doConfigure
    Read configuration options from properties. See #doConfigure(String,LoggerRepository) for the expect
  • configureLoggerFactory
    Check the provided Properties object for a org.apache.log4j.spi.LoggerFactoryentry specified by #LOG
  • configureRootCategory
  • parseAdditivityForLogger
    Parse the additivity option for a non-root category.
  • parseAppender
  • parseCategory
    This method must work for the root category as well.
  • parseCatsAndRenderers
    Parse non-root elements, such non-root categories and renderers.
  • registryGet
  • registryPut
  • parseAppenderFilters
  • registryPut,
  • parseAppenderFilters,
  • parseErrorHandler

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSupportFragmentManager (FragmentActivity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JFrame (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now