/**
* Copyright (C) 2001-2003 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import org.objectweb.util.monolog.api.LoggerFactory;
import org.objectweb.util.monolog.api.Logger;
import org.objectweb.util.monolog.api.BasicLevel;
import org.objectweb.util.monolog.Monolog;
/**
* @author S.Chassande-Barrioz
*/
public class RollingFile {
public static void main(String[] args) {
LoggerFactory lf;
switch(args.length) {
case 0:
//Let monolog find the monolog.properties in the classpath or use
// the default configuration
lf = Monolog.initialize();
break;
case 1:
// A monolog configuration file has been specified, then use it
lf = Monolog.getMonologFactory(args[0]);
break;
default:
System.out.println("Syntax error!\nUsage: java RollingFile [<monolog file name>]");
return;
}
RollingFile s = new RollingFile(lf);
s.foo();
}
protected Logger logger = null;
public RollingFile(LoggerFactory lf) {
logger = lf.getLogger("monolog.examples.RollingFile");
}
public void foo() {
for (int i=0; i<5000; i++)
logger.log(BasicLevel.DEBUG, "hello world " + i);
}
}