Updated log classes to match newer branches.
This commit is contained in:
parent
fb52876f79
commit
86a557fd60
@ -152,8 +152,7 @@ public class DimensionalRiftManager
|
||||
|
||||
public void loadSpawns()
|
||||
{
|
||||
int countGood = 0;
|
||||
int countBad = 0;
|
||||
int total = 0;
|
||||
try
|
||||
{
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
@ -239,11 +238,7 @@ public class DimensionalRiftManager
|
||||
spawnDat.setRespawnDelay(delay);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_rooms.get(type).get(roomId).getSpawns().add(spawnDat);
|
||||
countGood++;
|
||||
}
|
||||
else
|
||||
{
|
||||
countBad++;
|
||||
total++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -259,7 +254,7 @@ public class DimensionalRiftManager
|
||||
{
|
||||
LOGGER.warning("Error on loading dimensional rift spawns: " + e);
|
||||
}
|
||||
LOGGER.info("DimensionalRiftManager: Loaded " + countGood + " dimensional rift spawns, " + countBad + " errors.");
|
||||
LOGGER.info("DimensionalRiftManager: Loaded " + total + " dimensional rift spawns.");
|
||||
}
|
||||
|
||||
public void reload()
|
||||
|
@ -24,6 +24,6 @@ public class ChatFilter implements Filter
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record)
|
||||
{
|
||||
return record.getLoggerName().equals("chat");
|
||||
return "chat".equals(record.getLoggerName());
|
||||
}
|
||||
}
|
||||
|
@ -16,52 +16,40 @@
|
||||
*/
|
||||
package org.l2jmobius.log.filter;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Filter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.items.type.EtcItemType;
|
||||
|
||||
/**
|
||||
* @author Advi
|
||||
*/
|
||||
public class ItemFilter implements Filter
|
||||
{
|
||||
private String _excludeProcess;
|
||||
private String _excludeItemType;
|
||||
// private String _excludeProcess;
|
||||
// private String _excludeItemType;
|
||||
|
||||
// This is example how to exclude consuming of shots and arrows from logging
|
||||
// private String _excludeProcess = "Consume";
|
||||
// private String _excludeItemType = "Arrow, Shot";
|
||||
// This is an example how to exclude consuming of shots and arrows from logging
|
||||
private static final String EXCLUDE_PROCESS = "Consume";
|
||||
private static final Set<EtcItemType> EXCLUDED_ITEM_TYPES = new HashSet<>();
|
||||
static
|
||||
{
|
||||
EXCLUDED_ITEM_TYPES.add(EtcItemType.ARROW);
|
||||
EXCLUDED_ITEM_TYPES.add(EtcItemType.SHOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record)
|
||||
{
|
||||
if (!record.getLoggerName().equals("item"))
|
||||
if (!"item".equals(record.getLoggerName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_excludeProcess != null)
|
||||
{
|
||||
// if (record.getMessage() == null) return true;
|
||||
final String[] messageList = record.getMessage().split(":");
|
||||
|
||||
if ((messageList.length < 2) || !_excludeProcess.contains(messageList[1]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (_excludeItemType != null)
|
||||
{
|
||||
// if (record.getParameters() == null || record.getParameters().length == 0 || !(record.getParameters()[0] instanceof ItemInstance))
|
||||
// return true;
|
||||
final ItemInstance item = (ItemInstance) record.getParameters()[0];
|
||||
|
||||
if (!_excludeItemType.contains(item.getItemType().toString()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return (_excludeProcess == null) && (_excludeItemType == null);
|
||||
final String[] messageList = record.getMessage().split(":");
|
||||
return (messageList.length < 2) || !EXCLUDE_PROCESS.contains(messageList[1]) || !EXCLUDED_ITEM_TYPES.contains(((ItemInstance) record.getParameters()[0]).getItemType());
|
||||
}
|
||||
}
|
||||
|
@ -16,21 +16,26 @@
|
||||
*/
|
||||
package org.l2jmobius.log.formatter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @author zabbix
|
||||
*/
|
||||
public class AuditFormatter extends AbstractFormatter
|
||||
public class AuditFormatter extends Formatter
|
||||
{
|
||||
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
final Object[] params = record.getParameters();
|
||||
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
|
||||
output.append(super.format(record));
|
||||
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params == null ? 0 : params.length * 10), "[", dateFmt.format(new Date(record.getMillis())), "] ", record.getMessage());
|
||||
|
||||
if (params != null)
|
||||
{
|
||||
@ -40,12 +45,11 @@ public class AuditFormatter extends AbstractFormatter
|
||||
{
|
||||
continue;
|
||||
}
|
||||
output.append(", ");
|
||||
output.append(p);
|
||||
StringUtil.append(output, ", ", p.toString());
|
||||
}
|
||||
}
|
||||
output.append(Config.EOL);
|
||||
|
||||
output.append(Config.EOL);
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
|
@ -16,30 +16,33 @@
|
||||
*/
|
||||
package org.l2jmobius.log.formatter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
|
||||
public class ChatLogFormatter extends AbstractFormatter
|
||||
public class ChatLogFormatter extends Formatter
|
||||
{
|
||||
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
final Object[] params = record.getParameters();
|
||||
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
|
||||
output.append(super.format(record));
|
||||
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params != null ? 10 * params.length : 0), "[", dateFmt.format(new Date(record.getMillis())), "] ");
|
||||
|
||||
if (params != null)
|
||||
{
|
||||
for (Object p : params)
|
||||
{
|
||||
output.append(p);
|
||||
output.append(" ");
|
||||
StringUtil.append(output, String.valueOf(p), " ");
|
||||
}
|
||||
}
|
||||
|
||||
output.append(record.getMessage());
|
||||
output.append(Config.EOL);
|
||||
StringUtil.append(output, record.getMessage(), Config.EOL);
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
|
@ -16,32 +16,36 @@
|
||||
*/
|
||||
package org.l2jmobius.log.formatter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
import org.l2jmobius.commons.util.Util;
|
||||
|
||||
public class ConsoleLogFormatter extends AbstractFormatter
|
||||
public class ConsoleLogFormatter extends Formatter
|
||||
{
|
||||
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd/MM HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
final StringBuilder output = new StringBuilder(128);
|
||||
output.append(super.format(record));
|
||||
output.append(Config.EOL);
|
||||
final StringBuilder output = new StringBuilder(500);
|
||||
StringUtil.append(output, "[", dateFmt.format(new Date(record.getMillis())), "] " + record.getMessage(), Config.EOL);
|
||||
|
||||
if (record.getThrown() != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
output.append(Util.getStackTrace(record.getThrown()));
|
||||
output.append(Config.EOL);
|
||||
StringUtil.append(output, Util.getStackTrace(record.getThrown()), Config.EOL);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
}
|
||||
|
@ -18,28 +18,23 @@ package org.l2jmobius.log.formatter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
|
||||
/**
|
||||
* @version $Revision: 1.1.4.1 $ $Date: 2005/03/27 15:30:08 $
|
||||
*/
|
||||
public class FileLogFormatter extends Formatter
|
||||
{
|
||||
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS");
|
||||
private static final String TAB = "\t";
|
||||
private final SimpleDateFormat dateFmt = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss,SSS");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
final StringJoiner sj = new StringJoiner("\t", "", Config.EOL);
|
||||
sj.add(dateFormat.format(new Date(record.getMillis())));
|
||||
sj.add(record.getLevel().getName());
|
||||
sj.add(String.valueOf(record.getThreadID()));
|
||||
sj.add(record.getLoggerName());
|
||||
sj.add(record.getMessage());
|
||||
return sj.toString();
|
||||
return StringUtil.concat(dateFmt.format(new Date(record.getMillis())), TAB, record.getLevel().getName(), TAB, String.valueOf(record.getThreadID()), TAB, record.getLoggerName(), TAB, record.getMessage(), Config.EOL);
|
||||
}
|
||||
}
|
||||
|
@ -16,51 +16,52 @@
|
||||
*/
|
||||
package org.l2jmobius.log.formatter;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
|
||||
/**
|
||||
* @author Advi
|
||||
*/
|
||||
public class ItemLogFormatter extends AbstractFormatter
|
||||
public class ItemLogFormatter extends Formatter
|
||||
{
|
||||
private final SimpleDateFormat dateFmt = new SimpleDateFormat("dd MMM H:mm:ss");
|
||||
|
||||
@Override
|
||||
public String format(LogRecord record)
|
||||
{
|
||||
final Object[] params = record.getParameters();
|
||||
final StringBuilder output = new StringBuilder(32 + record.getMessage().length() + (params != null ? 10 * params.length : 0));
|
||||
output.append(super.format(record));
|
||||
final StringBuilder output = StringUtil.startAppend(30 + record.getMessage().length() + (params != null ? params.length * 50 : 0), "[", dateFmt.format(new Date(record.getMillis())), "] ", record.getMessage());
|
||||
|
||||
for (Object p : record.getParameters())
|
||||
if (params != null)
|
||||
{
|
||||
if (p == null)
|
||||
for (Object p : params)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
output.append(", ");
|
||||
if (p instanceof ItemInstance)
|
||||
{
|
||||
final ItemInstance item = (ItemInstance) p;
|
||||
output.append("item ");
|
||||
output.append(item.getObjectId());
|
||||
output.append(":");
|
||||
if (item.getEnchantLevel() > 0)
|
||||
if (p == null)
|
||||
{
|
||||
output.append("+");
|
||||
output.append(item.getEnchantLevel());
|
||||
output.append(" ");
|
||||
continue;
|
||||
}
|
||||
output.append(", ");
|
||||
if (p instanceof ItemInstance)
|
||||
{
|
||||
final ItemInstance item = (ItemInstance) p;
|
||||
StringUtil.append(output, "item ", String.valueOf(item.getObjectId()), ":");
|
||||
if (item.getEnchantLevel() > 0)
|
||||
{
|
||||
StringUtil.append(output, "+", String.valueOf(item.getEnchantLevel()), " ");
|
||||
}
|
||||
|
||||
StringUtil.append(output, item.getItem().getName(), "(", String.valueOf(item.getCount()), ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
output.append(p.toString());
|
||||
}
|
||||
|
||||
output.append(item.getItem().getName());
|
||||
output.append("(");
|
||||
output.append(item.getCount());
|
||||
output.append(")");
|
||||
}
|
||||
else
|
||||
{
|
||||
output.append(p);
|
||||
}
|
||||
}
|
||||
output.append(Config.EOL);
|
||||
|
Loading…
Reference in New Issue
Block a user