001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.log;
016    
017    import java.io.InputStream;
018    
019    import java.util.logging.LogManager;
020    import java.util.logging.Logger;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class Jdk14LogFactoryImpl implements LogFactory {
026    
027            public Jdk14LogFactoryImpl() {
028                    try {
029                            Class<?> clazz = getClass();
030    
031                            InputStream inputStream = clazz.getResourceAsStream(
032                                    "/logging.properties");
033    
034                            if (inputStream != null) {
035                                    LogManager logManager = LogManager.getLogManager();
036    
037                                    logManager.readConfiguration(inputStream);
038                            }
039                    }
040                    catch (Exception e) {
041                            e.printStackTrace();
042                    }
043            }
044    
045            @Override
046            public Log getLog(Class<?> c) {
047                    return getLog(c.getName());
048            }
049    
050            @Override
051            public Log getLog(String name) {
052                    return new Jdk14LogImpl(Logger.getLogger(name));
053            }
054    
055            @Override
056            public void setLevel(String name, String priority, boolean custom) {
057            }
058    
059    }