Java slf4j Logger logJavaProperties(Logger log)

Here you can find the source of logJavaProperties(Logger log)

Description

log Java Properties

License

Open Source License

Declaration

public static void logJavaProperties(Logger log) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 Sonatype, Inc.//from   w  ww. j a  v  a 2s  .co  m
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *      Sonatype, Inc. - initial API and implementation
 *******************************************************************************/

import java.util.Properties;
import java.util.SortedMap;
import java.util.TreeMap;
import org.slf4j.Logger;

public class Main {
    public static void logJavaProperties(Logger log) {
        Properties javaProperties = System.getProperties();
        SortedMap<String, String> sortedProperties = new TreeMap<String, String>();
        for (String key : javaProperties.stringPropertyNames()) {
            sortedProperties.put(key, javaProperties.getProperty(key));
        }
        log.debug("Java properties (ordered by property name):"); //$NON-NLS-1$
        for (String key : sortedProperties.keySet()) {
            log.debug("   {}={}", key, sortedProperties.get(key));
        }
    }
}

Related

  1. loggerForThisClass()
  2. loggerWithName(Class klass, String name)
  3. logInfo(Logger log)
  4. logInfo(Logger log, Throwable t)
  5. logInfo(Logger logger, String s)
  6. logLine(final Logger logger, final Level level, final String msg, final boolean withStackTrace, final String logMessagePrefix)
  7. logResult(long time, String traceId, String apiName, String params, String jsonObject)
  8. logThreadGroup(final Logger log, ThreadGroup group, int level)
  9. logThrowable(Throwable throwable)