Como mudar _log.info para System.out.println?

5 respostas
G
/*
 * 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, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver;

import java.util.logging.Logger;

import net.sf.l2j.Config;

public class L2JBrasil
{
	private static final Logger _log = Logger.getLogger(L2JBrasil.class.getName());

	/**
	 * L2JBrasil Info
	 */
	public static void info()

	{

		_log.info("----------------------------------------------------------------------");
		_log.info("               L2J Brasil Core Version:     " + Config.SERVER_VERSION    );
		_log.info("               L2J Brasil taPack Version: " + Config.DATAPACK_VERSION  );
		_log.info("                        Copyright 2009-2010                           ");
		_log.info("----------------------------------------------------------------------");
	}
}

private static final Logger _log = Logger.getLogger(L2JBrasil.class.getName()); <--- aki ele le _log.info

e como eu fasso pra usa --> System.out.println

pq eu queria fase assim

/*
 * 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, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver;

import java.util.logging.Logger;

import net.sf.l2j.Config;

public class L2JBrasil
{
	private static final Logger _log = Logger.getLogger(L2JBrasil.class.getName()); 

	/**
	 * L2JBrasil Info
	 */
	public static void info()

	{

        System.out.println(" /\ \       /'___`\   __/\  _`\                         __ /\_ \      "):
        System.out.println(" \ \ \     /\_\ /\ \ /\_\ \ \L\ \  _ __    __      ____/\_\//\ \     "):  
        System.out.println("  \ \ \  __\/_/// /__\/\ \ \  _ <'/

[code]/*
 * 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, either version 3 of the License, or (at your option) any later
 * version.
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver;

import java.util.logging.Logger;

import net.sf.l2j.Config;

public class L2JBrasil
{
	private static final Logger _log = Logger.getLogger(L2JBrasil.class.getName());

	/**
	 * L2JBrasil Info
	 */
	public static void info()

	{

		_log.info("----------------------------------------------------------------------");
		_log.info("               L2J Brasil Core Version:     " + Config.SERVER_VERSION    );
		_log.info("               L2J Brasil taPack Version: " + Config.DATAPACK_VERSION  );
		_log.info("                        Copyright 2009-2010                           ");
		_log.info("----------------------------------------------------------------------");
	}
}

private static final Logger _log = Logger.getLogger(L2JBrasil.class.getName()); <--- aki ele le _log.info

e como eu fasso pra usa --> System.out.println

pq eu queria fase assim

'__\/'__`\ /',__\/\ \ \ \ \ "):
System.out.println(" \ \ \L\ \ // /_\ \ \ \ \ \L\ \ \ \//\ \L\.\_/\__, `\ \ \ \_\ \_ "):
System.out.println(" \ \____/ /\______/_\ \ \ \____/\ \_\ \__/.\_\/\____/\ \_\/\____\ "):
System.out.println(" \/___/ \/_____//\ \_\ \/___/ \/_/ \/__/\/_/\/___/ \/_/\/____/ "):
System.out.println(" \ \____/ "):
System.out.println(" \/___/ "):
System.out.println(" ");
}
}
[/code]

entao a minha pergunta e:

o q eu tenho q por aki nessa linha abaixo pra ele le esse codigo System.out.println e nao esse _log.info

private static final Logger _log = Logger.getLogger(L2JBrasil.class.getName());

5 Respostas

ctosin

Guma,

Você deve configurar o seu Log4j para direcionar o logger net.sf.l2j.gameserver.L2JBrasil para o System.out quando você usa o nível INFO. Se você não está muito por dentro de Log4j, sugiro que você dê uma lida em como fazer a configuração correta. Este link pode te ajudar: http://logging.apache.org/log4j/1.2/manual.html

Abraço

G

vo da uma boa olhada
obg.

M

ctosin:
Guma,

Você deve configurar o seu Log4j para direcionar o logger net.sf.l2j.gameserver.L2JBrasil para o System.out quando você usa o nível INFO. Se você não está muito por dentro de Log4j, sugiro que você dê uma lida em como fazer a configuração correta. Este link pode te ajudar: http://logging.apache.org/log4j/1.2/manual.html

Abraço


Mas ele não está usando Apache Logging e sim a classe Logger de java.util.logging.

Guma, entenda o seguinte: a classe Logger serve justamente para fazer logs de eventos (seja via console ou também para arquivos de log). Se você quer apenas mostrar um texto na saída padrão não precisa usar Logger. Simplesmente remova-o e use System.out.println().

G

mas ai da erro =X

M

Como assim “dá erro”? O que acontece? Não imprime? Alguma exceção ocorre? Se sim, qual?

Criado 17 de dezembro de 2009
Ultima resposta 23 de dez. de 2009
Respostas 5
Participantes 3