com.clustercontrol.util.StdOutErrLog.java Source code

Java tutorial

Introduction

Here is the source code for com.clustercontrol.util.StdOutErrLog.java

Source

/*
    
Copyright (C) 2012 NTT DATA Corporation
    
This program is free software; you can redistribute it and/or
Modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, version 2.
    
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the GNU General Public License for more details.
    
 */

package com.clustercontrol.util;

import java.io.PrintStream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * log4j??<br/>
 */
public class StdOutErrLog {

    public static final Log log = LogFactory.getLog(StdOutErrLog.class);

    /**
     * ?log4j??<br/>
     */
    public static void initialize() {
        System.setOut(new PrintStream(new LoggerStream(log)));
        System.setErr(new PrintStream(new LoggerStream(log)));
    }
}