Java Examples for org.apache.logging.log4j.Level
The following java examples will help you to understand the usage of org.apache.logging.log4j.Level. These source code samples are taken from different open source projects.
Example 1
Project: vethrfolnir-mu-master File: MelloriLogHandler.java View source code |
/* * (non-Javadoc) * @see java.util.logging.Handler#publish(java.util.logging.LogRecord) */ @Override public void publish(LogRecord record) { String loggerName = record.getLoggerName(); if (loggerName == null) { loggerName = ""; } Logger log = LogManager.getLogger(loggerName); org.apache.logging.log4j.Level level = levels.get(record.getLevel()); if (level == null) { log.warn("Cannot find log4j level for: " + record.getLevel()); level = org.apache.logging.log4j.Level.INFO; } String message = (record.getParameters() != null) && (record.getParameters().length > 0) ? MessageFormat.format(record.getMessage(), record.getParameters()) : record.getMessage(); // Resource waster here // TODO: Finish all the logging then remove this String[] splits = record.getLoggerName().split("\\."); if (message.contains(splits[splits.length - 1] + ": ")) message = message.replace(splits[splits.length - 1] + ":", ""); log.log(level, message, record.getThrown()); }
Example 2
Project: tomee-master File: Log4j2Logger.java View source code |
private Level fromL4J(final org.apache.logging.log4j.Level l) { Level l2 = null; switch(l.getStandardLevel()) { case ALL: l2 = Level.ALL; break; case FATAL: l2 = Level.SEVERE; break; case ERROR: l2 = Level.SEVERE; break; case WARN: l2 = Level.WARNING; break; case INFO: l2 = Level.INFO; break; case DEBUG: l2 = Level.FINE; break; case OFF: l2 = Level.OFF; break; case TRACE: l2 = Level.FINEST; break; default: l2 = Level.FINE; } return l2; }
Example 3
Project: haze-master File: Log4j2Factory.java View source code |
private static org.apache.logging.log4j.Level toLog4j2Level(Level level) { return level == Level.FINEST ? org.apache.logging.log4j.Level.TRACE : level == Level.FINE ? org.apache.logging.log4j.Level.DEBUG : level == Level.INFO ? org.apache.logging.log4j.Level.INFO : level == Level.WARNING ? org.apache.logging.log4j.Level.WARN : level == Level.SEVERE ? org.apache.logging.log4j.Level.ERROR : level == Level.FINER ? org.apache.logging.log4j.Level.DEBUG : level == Level.CONFIG ? org.apache.logging.log4j.Level.INFO : level == Level.OFF ? org.apache.logging.log4j.Level.OFF : org.apache.logging.log4j.Level.INFO; }
Example 4
Project: hazelcast-master File: Log4j2Factory.java View source code |
private static org.apache.logging.log4j.Level toLog4j2Level(Level level) { return level == Level.FINEST ? org.apache.logging.log4j.Level.TRACE : level == Level.FINE ? org.apache.logging.log4j.Level.DEBUG : level == Level.INFO ? org.apache.logging.log4j.Level.INFO : level == Level.WARNING ? org.apache.logging.log4j.Level.WARN : level == Level.SEVERE ? org.apache.logging.log4j.Level.ERROR : level == Level.FINER ? org.apache.logging.log4j.Level.DEBUG : level == Level.CONFIG ? org.apache.logging.log4j.Level.INFO : level == Level.OFF ? org.apache.logging.log4j.Level.OFF : org.apache.logging.log4j.Level.INFO; }
Example 5
Project: org.ops4j.pax.logging-master File: Log4j2Logger.java View source code |
@Override protected void doLog(final Level level, final String loggerClassName, final Object message, final Object[] parameters, final Throwable thrown) { final org.apache.logging.log4j.Level translatedLevel = Log4j2Logger.translate(level); if (this.logger.isEnabled(translatedLevel)) { try { this.logger.logMessage(loggerClassName, translatedLevel, null, (parameters == null || parameters.length == 0) ? this.messageFactory.newMessage(message) : this.messageFactory.newMessage(String.valueOf(message), parameters), thrown); } catch (Throwable ignored) { } } }
Example 6
Project: Realistic-Terrain-Generation-master File: Config.java View source code |
public void load(String configFile) {
Configuration config = new Configuration(new File(configFile));
try {
config.load();
ArrayList<ConfigProperty> properties = this.getProperties();
for (int j = 0; j < properties.size(); j++) {
ConfigProperty prop = properties.get(j);
switch(prop.type) {
case INTEGER:
ConfigPropertyInt propInt = (ConfigPropertyInt) properties.get(j);
propInt.set(config.getInt(propInt.name, propInt.category, propInt.valueInt, propInt.minValueInt, propInt.maxValueInt, prop.description));
break;
case FLOAT:
ConfigPropertyFloat propFloat = (ConfigPropertyFloat) properties.get(j);
propFloat.set(config.getFloat(propFloat.name, propFloat.category, propFloat.valueFloat, propFloat.minValueFloat, propFloat.maxValueFloat, propFloat.description));
break;
case BOOLEAN:
ConfigPropertyBoolean propBool = (ConfigPropertyBoolean) properties.get(j);
propBool.set(config.getBoolean(propBool.name, propBool.category, propBool.valueBoolean, propBool.description));
break;
case STRING:
ConfigPropertyString propString = (ConfigPropertyString) properties.get(j);
propString.set(config.getString(propString.name, propString.category, propString.valueString, propString.description));
break;
default:
throw new RuntimeException("ConfigProperty type not supported.");
}
}
} catch (Exception e) {
FMLLog.log(Level.ERROR, "[RTG-ERROR] RTG had a problem loading config: %s", configFile);
} finally {
if (config.hasChanged()) {
config.save();
}
}
}
Example 7
Project: jodd-master File: Log4j2Logger.java View source code |
/** * Converts Jodd logging level to JDK. */ private org.apache.logging.log4j.Level jodd2log4j2(Logger.Level level) { switch(level) { case TRACE: return org.apache.logging.log4j.Level.TRACE; case DEBUG: return org.apache.logging.log4j.Level.DEBUG; case INFO: return org.apache.logging.log4j.Level.INFO; case WARN: return org.apache.logging.log4j.Level.WARN; case ERROR: return org.apache.logging.log4j.Level.ERROR; default: throw new IllegalArgumentException(); } }
Example 8
Project: ServerListPlus-master File: Log4j2ServerListPlusLogger.java View source code |
private static org.apache.logging.log4j.Level convertLevel(Level level) { if (level == ERROR) { return org.apache.logging.log4j.Level.ERROR; } else if (level == WARN) { return org.apache.logging.log4j.Level.WARN; } else if (level == INFO) { return org.apache.logging.log4j.Level.INFO; } else if (level == REPORT) { return org.apache.logging.log4j.Level.DEBUG; } else { return org.apache.logging.log4j.Level.TRACE; } }
Example 9
Project: logging-log4j2-master File: ConfigurationBuilderTest.java View source code |
private void addTestFixtures(final String name, final ConfigurationBuilder<BuiltConfiguration> builder) { builder.setConfigurationName(name); builder.setStatusLevel(Level.ERROR); builder.setShutdownTimeout(5000, TimeUnit.MILLISECONDS); builder.add(builder.newScriptFile("target/test-classes/scripts/filter.groovy").addIsWatched(true)); builder.add(builder.newFilter("ThresholdFilter", Filter.Result.ACCEPT, Filter.Result.NEUTRAL).addAttribute("level", Level.DEBUG)); final AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT); appenderBuilder.add(builder.newLayout("PatternLayout").addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable")); appenderBuilder.add(builder.newFilter("MarkerFilter", Filter.Result.DENY, Filter.Result.NEUTRAL).addAttribute("marker", "FLOW")); builder.add(appenderBuilder); final AppenderComponentBuilder appenderBuilder2 = builder.newAppender("Kafka", "Kafka").addAttribute("topic", "my-topic"); appenderBuilder2.addComponent(builder.newProperty("bootstrap.servers", "localhost:9092")); appenderBuilder2.add(builder.newLayout("GelfLayout").addAttribute("host", "my-host").addComponent(builder.newKeyValuePair("extraField", "extraValue"))); builder.add(appenderBuilder2); builder.add(builder.newLogger("org.apache.logging.log4j", Level.DEBUG, true).add(builder.newAppenderRef("Stdout")).addAttribute("additivity", false)); builder.add(builder.newRootLogger(Level.ERROR).add(builder.newAppenderRef("Stdout"))); builder.addProperty("MyKey", "MyValue"); builder.add(builder.newCustomLevel("Panic", 17)); builder.setPackages("foo,bar"); }
Example 10
Project: 4Space-1.7-master File: ConfigManagerVenus.java View source code |
private void setDefaultValues() {
try {
ConfigManagerVenus.configuration.load();
ConfigManagerVenus.idVenusEnabled = ConfigManagerVenus.configuration.get(Configuration.CATEGORY_GENERAL, "Should Venus, Items and Blocks be registered in the game (Sorry you cannot disable Venus.)", true).getBoolean(true);
ConfigManagerVenus.idDimensionVenus = ConfigManagerVenus.configuration.get(Configuration.CATEGORY_GENERAL, "Venus Dimension", -41).getInt(-41);
ConfigManagerVenus.idDayLength = ConfigManagerVenus.configuration.get(Configuration.CATEGORY_GENERAL, "Venus Day Length Realistic", true).getBoolean(true);
ConfigManagerVenus.idFlamelingCreeper = ConfigManagerVenus.configuration.get(Configuration.CATEGORY_GENERAL, "Enable this if you want creepers to have a enemy...", false).getBoolean(false);
ConfigManagerVenus.idBiomeVenus = ConfigManagerVenus.configuration.get(Configuration.CATEGORY_GENERAL, "Venus Biome", 211).getInt(211);
} catch (final Exception e) {
FMLLog.log(Level.ERROR, e, "4Space Venus Config has a problem loading it's configuration");
} finally {
ConfigManagerVenus.configuration.save();
ConfigManagerVenus.loaded = true;
}
}
Example 11
Project: GardenCollection-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 12
Project: PowerAdvantageAPI-master File: Villages.java View source code |
public static void init() {
if (initDone)
return;
Entities.init();
try {
VillagerTradeHelper.insertTrades(3, 3, 1, new EntityVillager.ListItemForEmeralds(Items.sprocket, new EntityVillager.PriceInfo(-4, -1)));
VillagerTradeHelper.insertTrades(0, 1, 1, new EntityVillager.ListItemForEmeralds(Items.bioplastic_ingot, new EntityVillager.PriceInfo(-8, -4)));
} catch (NoSuchFieldExceptionIllegalAccessException | e) {
FMLLog.log(Level.ERROR, e, "Failed to add trades to villagers");
}
initDone = true;
}
Example 13
Project: Quadrum-2-master File: JsonVerification.java View source code |
public static boolean verifyRequirements(File file, JsonObject jsonObject, Class<?> clazz) {
List<String> keys = Lists.newArrayList();
for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) keys.add(entry.getKey());
List<String> missingFields = Lists.newArrayList();
for (Field field : clazz.getDeclaredFields()) {
String name = field.getName();
if (field.getAnnotation(SerializedName.class) != null)
name = field.getAnnotation(SerializedName.class).value();
if (field.getAnnotation(Required.class) != null && !keys.contains(name))
missingFields.add(name);
}
if (!missingFields.isEmpty()) {
Quadrum.log(Level.WARN, ERROR, file.getName(), missingFields);
return false;
} else
return true;
}
Example 14
Project: Quadrum-master File: QuadrumSprite.java View source code |
@Override
public boolean load(IResourceManager manager, ResourceLocation location) {
BufferedImage image;
try {
if (block) {
image = ImageIO.read(new File(Quadrum.blockTextureDir, location.getResourcePath() + ".png"));
} else {
image = ImageIO.read(new File(Quadrum.itemTextureDir, location.getResourcePath() + ".png"));
}
} catch (IOException ex) {
Quadrum.log(Level.WARN, "Failed to load " + (block ? "block" : "item") + " texture %s. Reason: %s", (location.getResourcePath() + ".png"), ex.getMessage());
if (Quadrum.textureStackTrace)
ex.printStackTrace();
failed = true;
return true;
}
if (image != null) {
GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
BufferedImage[] array = new BufferedImage[1 + gameSettings.mipmapLevels];
array[0] = image;
this.loadSprite(array, null, (float) gameSettings.anisotropicFiltering > 1.0F);
return false;
}
return true;
}
Example 15
Project: simpleretrogen-master File: TestGenerator.java View source code |
@Mod.EventHandler
public void preinit(FMLPreInitializationEvent init) {
final Logger modLog = init.getModLog();
IWorldGenerator gen = new IWorldGenerator() {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
modLog.log(Level.INFO, "Calling!");
}
};
GameRegistry.registerWorldGenerator(gen, 10);
}
Example 16
Project: Town-Builder-master File: ConfigHandler.java View source code |
public static void syncConfig() {
try {
// if (TownBuilder.proxy.isDedicatedServer()) filePort = config.get(Configuration.CATEGORY_GENERAL, "Schematic upload port", 25570, "This is the ports that will be used to upload schematic files to the server").getInt();
} catch (Exception e) {
FMLLog.log(Level.ERROR, "Unable to load Config");
e.printStackTrace();
} finally {
if (config.hasChanged())
config.save();
}
}
Example 17
Project: xmlsh-master File: log.java View source code |
@Override
public int run(List<XValue> args) throws Exception {
Options opts = new Options("c=class:,p=priority:");
opts.parse(args);
String sClass = opts.getOptString("c", log.class.getName());
String sLevel = opts.getOptString("p", "info");
Level level = parseLevel(sLevel);
args = opts.getRemainingArgs();
/*
* Serialize all output into a single string
*
*/
ByteArrayOutputStream out = new ByteArrayOutputStream();
args = Util.expandSequences(args);
boolean bFirst = true;
for (XValue arg : args) {
if (!bFirst)
out.write(' ');
bFirst = false;
arg.serialize(out, getSerializeOpts());
}
out.flush();
Logger logger = org.apache.logging.log4j.LogManager.getLogger(sClass);
logger.log(level, out.toString(getSerializeOpts().getOutputTextEncoding()));
return 0;
}
Example 18
Project: carpentersblocks-master File: PacketHandler.java View source code |
@SubscribeEvent
public void onServerPacket(ServerCustomPacketEvent event) throws IOException {
ByteBufInputStream bbis = new ByteBufInputStream(event.packet.payload());
EntityPlayer entityPlayer = ((NetHandlerPlayServer) event.handler).playerEntity;
int packetId = bbis.readInt();
if (packetId < packetCarrier.size()) {
try {
ICarpentersPacket packetClass = (ICarpentersPacket) packetCarrier.get(packetId).newInstance();
packetClass.processData(entityPlayer, bbis);
} catch (Exception e) {
e.printStackTrace();
}
} else {
ModLogger.log(Level.WARN, "Encountered out of range packet Id: " + packetId);
}
bbis.close();
}
Example 19
Project: CompactWindmills-master File: WindType.java View source code |
public static TileEntityWindmill makeTileEntity(int metadata) {
try {
TileEntityWindmill tileEntity = values()[metadata].claSS.newInstance();
return tileEntity;
} catch (Exception e) {
CompactWindmills.instance.windMillLog.log(Level.WARN, "Failed to Register Windmill: " + WindType.values()[metadata].name());
throw Throwables.propagate(e);
}
}
Example 20
Project: ElectricAdvantage-master File: Villages.java View source code |
public static void init() {
if (initDone)
return;
Entities.init();
try {
VillagerTradeHelper.insertTrades(1, 1, 2, new EntityVillager.ListItemForEmeralds(Items.petrolplastic_ingot, new EntityVillager.PriceInfo(-8, -4)));
VillagerTradeHelper.insertTrades(1, 1, 1, new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.electric_conduit), new EntityVillager.PriceInfo(-6, -3)));
VillagerTradeHelper.insertTrades(1, 1, 1, new EntityVillager.ListItemForEmeralds(Items.solder, new EntityVillager.PriceInfo(-10, -5)));
VillagerTradeHelper.insertTrades(1, 1, 1, new EntityVillager.ListItemForEmeralds(Items.integrated_circuit, new EntityVillager.PriceInfo(-6, -3)));
VillagerTradeHelper.insertTrades(1, 1, 1, new EntityVillager.ListItemForEmeralds(Items.blank_circuit_board, new EntityVillager.PriceInfo(-6, -3)));
VillagerTradeHelper.insertTrades(1, 1, 2, new EntityVillager.ListItemForEmeralds(Items.power_supply_unit, new EntityVillager.PriceInfo(1, 3)));
} catch (NoSuchFieldExceptionIllegalAccessException | e) {
FMLLog.log(Level.ERROR, e, "Failed to add trades to villagers");
}
initDone = true;
}
Example 21
Project: Extended-Potions-master File: ExtendedPotions.java View source code |
private void extendPotionArray() { try { Field potionTypesField = Potion.class.getDeclaredField(MCPNames.field("field_76425_a")); makeModifiable(potionTypesField); int potionArraySize = Potion.potionTypes.length; if (potionArraySize < newPotionSize) { Potion[] newArray = new Potion[newPotionSize]; for (int i = 0; i < potionArraySize; i++) { newArray[i] = Potion.potionTypes[i]; } potionTypesField.set(null, newArray); logger.log(Level.INFO, "Extended Potion Array to " + newPotionSize); } } catch (Exception e) { e.printStackTrace(); logger.log(Level.INFO, "Could not extend Potion Array"); } }
Example 22
Project: LookingGlass-master File: LoggerUtils.java View source code |
public static void log(Level level, String message, Object... params) {
if (log == null) {
configureLogging();
}
if (message == null) {
log.log(level, "Attempted to log null message.");
} else {
try {
message = String.format(message, params);
} catch (Exception e) {
}
log.log(level, message);
}
}
Example 23
Project: maxwell-master File: Logging.java View source code |
public static void setLevel(String level) {
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
loggerConfig.setLevel(Level.valueOf(level));
// This causes all Loggers to refetch information from their LoggerConfig.
ctx.updateLoggers();
}
Example 24
Project: Minestellar-master File: ConfigManagerMoon.java View source code |
private void setDefaultValues() {
try {
ConfigManagerMoon.configuration.load();
ConfigManagerMoon.idDimensionMoon = ConfigManagerMoon.configuration.get(Constants.CONFIGURATION_DIMENSIONS, "Moon Dimension", -25).getInt(-25);
ConfigManagerMoon.idBiomeMoon = ConfigManagerMoon.configuration.get(Constants.CONFIGURATION_BIOMES, "Moon Biome", 225).getInt(225);
} catch (final Exception e) {
FMLLog.log(Level.ERROR, e, "Minestellar Moon Config has a problem loading it's configuration");
} finally {
ConfigManagerMoon.configuration.save();
ConfigManagerMoon.loaded = true;
}
}
Example 25
Project: Mini-Bosses-master File: ConfigHelper.java View source code |
public static void setupConfig(Configuration config, Logger logger) {
try {
config.load();
allowSlimeBlockCrafting = config.get("General", "allowSlimeBlockCrafting", false).getBoolean(false);
microBossesEnabled = config.get("Entities", "microBossesEnabled", true).getBoolean(true);
ironZombieSpawnRate = config.get("Spawning", "ironZombieSpawnRate", 10).getInt(10);
forestGuardSpawnRate = config.get("Spawning", "forestGuardSpawnRate", 10).getInt(10);
crawlerSpawnRate = config.get("Spawning", "crawlerSpawnRate", 10).getInt(10);
superSlimeSpawnRate = config.get("Spawning", "superSlimeSpawnRate", 10).getInt(10);
stealthCreeperSpawnRate = config.get("Spawning", "stealthCreeperSpawnRate", 10).getInt(10);
enableGiantSpawn = config.get("Spawning", "enableGiantSpawn", false).getBoolean(false);
giantSpawnRate = config.get("Spawning", "giantSpawnRate", 10).getInt(10);
feederSpawnRate = config.get("Spawning", "feederSpawnRate", 10).getInt(10);
infernoGolemSpawnRate = config.get("Spawning", "infernoGolemSpawnRate", 10).getInt(10);
addMiniBossesToDungeons = config.get("General", "addMiniBossesToDungeons", true).getBoolean(true);
addLootToDungeons = config.get("General", "addLootToDungeons", true).getBoolean(true);
powersEnabled = config.get("General", "powersEnabled", true).getBoolean(true);
ironZombieFix = config.getBoolean("IronZombieFix", "General", false, "Kills all iron zombies in the world. Should only be used once to fix iron zombies broken in 1.8!!!!");
enableLivingBlocks = config.getBoolean("enableLivingBlocks", "Spawning", true, "Enables/Disables living blocks from spawning.");
mobLootRarity = config.getInt("MobLootRarity", "General", 50, 0, 100, "How rare the loot dropped by crawlers and forest guard's is. Higher numbers(X/100) means rarer items. ");
canFeederEatSword = config.getBoolean("CanFeederEatSword", "General", true, "Whether or not the feeder can eat your sword(1/40 chance of happening)");
} catch (Exception e) {
logger.log(Level.ERROR, "A severe error has occured when attempting to load the config file for this mod! Some options may not be the way you set them!");
} finally {
if (config.hasChanged()) {
config.save();
}
}
}
Example 26
Project: Railcraft-master File: TileSignalBlockSignal.java View source code |
@Override
public void updateEntity() {
super.updateEntity();
if (Game.isNotHost(worldObj)) {
controller.tickClient();
signalBlock.tickClient();
return;
}
controller.tickServer();
signalBlock.tickServer();
SignalAspect prevAspect = controller.getAspect();
if (controller.isBeingPaired()) {
controller.setAspect(SignalAspect.BLINK_YELLOW);
} else {
controller.setAspect(signalBlock.getSignalAspect());
}
if (prevAspect != controller.getAspect()) {
sendUpdateToClient();
}
if (SignalTools.printSignalDebug && prevAspect != SignalAspect.BLINK_RED && controller.getAspect() == SignalAspect.BLINK_RED) {
Game.log(Level.INFO, "Signal Tile changed aspect to BLINK_RED: source:[{0}, {1}, {2}]", xCoord, yCoord, zCoord);
}
}
Example 27
Project: SwornGuard-master File: LogFilterHandler.java View source code |
private final boolean filter(String message) {
if (message == null) {
plugin.getLogHandler().log(Level.WARNING, "Encountered a null message!");
// Probably bukkit's piss-poor way of handling command exceptions
return true;
}
// Do internal checks first
if (message.contains("moved too quickly!")) {
String playerName = message.split(" ")[0];
Player player = Util.matchPlayer(playerName);
if (player != null) {
if (speedDetectorEnabled) {
if (!plugin.getPermissionHandler().hasPermission(player, Permission.ALLOW_FLY)) {
if (!player.getAllowFlight() && !player.isInsideVehicle()) {
if (!preconditions.isPlayerFallingIntoVoid(player) && !preconditions.isPlayerInsideCar(player) && !preconditions.isNewPlayerJoin(player) && !preconditions.hasRecentlyTeleported(player)) {
PlayerData data = plugin.getPlayerDataCache().getData(player);
data.setConsecutivePings(data.getConsecutivePings() + 1);
if (data.getConsecutivePings() >= 2) {
// Announce the cheat
CheatEvent event = new CheatEvent(player, CheatType.SPEED, FormatUtil.format(plugin.getMessage("cheat_message"), player.getName(), "moving too quickly!"));
plugin.getCheatHandler().announceCheat(event);
// Reset their consecutive pings
data.setConsecutivePings(0);
}
}
}
}
}
return false;
}
}
// Now filter messages defined in the config
if (!logFilters.isEmpty()) {
for (Pattern filter : logFilters) {
if (filter.matcher(message).matches()) {
return false;
}
}
}
return true;
}
Example 28
Project: instrumentation-master File: InstrumentedAppender.java View source code |
@Override
public void append(LogEvent event) {
Level level = event.getLevel();
if (TRACE.equals(level))
TRACE_LABEL.inc();
else if (DEBUG.equals(level))
DEBUG_LABEL.inc();
else if (INFO.equals(level))
INFO_LABEL.inc();
else if (WARN.equals(level))
WARN_LABEL.inc();
else if (ERROR.equals(level))
ERROR_LABEL.inc();
else if (FATAL.equals(level))
FATAL_LABEL.inc();
}
Example 29
Project: BuildCraft-master File: BCLog.java View source code |
public static void logErrorAPI(Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); msg.append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 30
Project: Connected-master File: BCLog.java View source code |
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder(mod); msg.append(" API error, please update your mods. Error: ").append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg = new StringBuilder(mod); msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 31
Project: craft-master File: BCLog.java View source code |
public static void logErrorAPI(Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); msg.append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 32
Project: EmashersMods-master File: FuelManager.java View source code |
/** * Register the amount of heat in a bucket of liquid fuel. * * @param fluid * @param heatValuePerBucket */ public static void addBoilerFuel(Fluid fluid, int heatValuePerBucket) { ModContainer mod = Loader.instance().activeModContainer(); String modName = mod != null ? mod.getName() : "An Unknown Mod"; if (fluid == null) { FMLLog.log("Railcraft", Level.WARN, String.format("An error occured while %s was registering a Boiler fuel source", modName)); return; } boilerFuel.put(fluid, heatValuePerBucket); FMLLog.log("Railcraft", Level.DEBUG, String.format("%s registered \"%s\" as a valid Boiler fuel source with %d heat.", modName, fluid.getName(), heatValuePerBucket)); }
Example 33
Project: ExtraCarts-1.7.10-master File: ExtraCarts.java View source code |
@EventHandler public void init(FMLPreInitializationEvent event) { ConfigHandler.setConfigFile(event.getSuggestedConfigurationFile()); ConfigHandler.init(); for (Module module : ModInfo.getModules()) { if (!module.areRequirementsMet() && module.getIsActive()) { module.setIsActive(false); LogUtils.log(Level.ERROR, "Requirements are not met for " + module.getModuleName() + ". Deactivating"); } if (module.getIsActive()) { LogUtils.log(Level.INFO, "Loading " + module.getModuleName() + " module"); } } for (Module module : ModInfo.getModules()) { if (module.getIsActive()) module.init(event); } FakeBlockRegistry.registerBlocks(); proxy.init(event); }
Example 34
Project: FML-master File: ZipperUtil.java View source code |
public static void backupWorld(String dirName) throws IOException {
File dstFolder = FMLCommonHandler.instance().getSavesDirectory();
File zip = new File(dstFolder, String.format("%s-%2$tY%2$tm%2$td-%2$tH%2$tM%2$tS.zip", dirName, System.currentTimeMillis()));
try {
ZipperUtil.zip(new File(dstFolder, dirName), zip);
} catch (IOException e) {
FMLLog.log(Level.WARN, e, "World backup failed.");
throw e;
}
FMLLog.info("World backup created at %s.", zip.getCanonicalPath());
}
Example 35
Project: forge-master File: BCLog.java View source code |
public static void logErrorAPI(Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); msg.append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 36
Project: Framez-master File: BCLog.java View source code |
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder(mod); msg.append(" API error, please update your mods. Error: ").append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg = new StringBuilder(mod); msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 37
Project: Galacticraft-master File: ConfigManagerVenus.java View source code |
public static void syncConfig(boolean load, boolean update) {
try {
Property prop;
Property propCopy;
if (!config.isChild) {
if (update) {
config.load();
}
}
prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "dimensionIDVenus", -31);
prop.comment = "Dimension ID for Venus";
prop.setLanguageKey("gc.configgui.dimensionIDVenus").setRequiresMcRestart(true);
if (update) {
propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, prop.getName(), prop.getInt(), prop.comment);
propCopy.setLanguageKey(prop.getLanguageKey());
propCopy.setRequiresMcRestart(prop.requiresMcRestart());
}
dimensionIDVenus = prop.getInt();
prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "disableAmbientLightning", false);
prop.comment = "Disables background thunder and lightning.";
prop.setLanguageKey("gc.configgui.disableAmbientLightning");
disableAmbientLightning = prop.getBoolean(false);
if (load) {
ConfigManagerMars.config.setCategoryPropertyOrder(Constants.CONFIG_CATEGORY_WORLDGEN, ConfigManagerMars.propOrder);
}
//Always save - this is last to be called both at load time and at mid-game
if (ConfigManagerMars.config.hasChanged()) {
ConfigManagerMars.config.save();
}
} catch (final Exception e) {
FMLLog.log(Level.ERROR, e, "Galacticraft Asteroids (Planets) has a problem loading it's config");
}
}
Example 38
Project: GearSwapper-master File: GearSwap.java View source code |
/** * Handle interaction with other mods, complete your setup based on this. */ @Mod.EventHandler public void postInit(FMLPostInitializationEvent e) { proxy.postInit(e); baubles = Loader.isModLoaded("Baubles"); if (baubles) { if (Config.supportBaubles) { logger.log(Level.INFO, "Gear Swapper Detected Baubles: enabling support"); } else { logger.log(Level.INFO, "Gear Swapper Detected Baubles but it is disabled in config anyway: disabling support"); baubles = false; } } }
Example 39
Project: geode-master File: LogWriterLoggerDisabledPerformanceTest.java View source code |
@Override
protected PerformanceLogger createPerformanceLogger() throws IOException {
final Logger logger = createLogger();
final PerformanceLogger perfLogger = new PerformanceLogger() {
@Override
public void log(String message) {
logger.debug(message);
}
@Override
public boolean isEnabled() {
return logger.isEnabled(Level.DEBUG);
}
};
return perfLogger;
}
Example 40
Project: graylog2-server-master File: LoggersResourceTest.java View source code |
@Test public void setLoggerLevelOnlySetsLoggersLevel() throws Exception { final String parentLoggerName = "LoggersResourceTest"; final String loggerName = "LoggersResourceTest.setLoggerLevelOnlySetsLoggersLevel"; final Level originalLevel = resource.getLoggerLevel(loggerName); final Level parentLevel = resource.getLoggerLevel(parentLoggerName); assertThat(originalLevel).isEqualTo(parentLevel); final Level expectedLevel = Level.TRACE; assertThat(originalLevel).isNotEqualTo(expectedLevel); resource.setLoggerLevel(loggerName, expectedLevel); assertThat(resource.getLoggerLevel(parentLoggerName)).isEqualTo(parentLevel); assertThat(resource.getLoggerLevel(loggerName)).isEqualTo(expectedLevel); resource.setLoggerLevel(loggerName, originalLevel); assertThat(resource.getLoggerLevel(parentLoggerName)).isEqualTo(parentLevel); assertThat(resource.getLoggerLevel(loggerName)).isEqualTo(originalLevel); }
Example 41
Project: HarderStart-master File: CuttingTableRecipeManager.java View source code |
public ItemStack[] getValidRecipe(ItemStack stack, ItemStack toolStack) {
List<ICuttingTableRecipe> recipes = getRecipeList();
Iterator<ICuttingTableRecipe> iterator = recipes.iterator();
while (iterator.hasNext()) {
ICuttingTableRecipe recipe = iterator.next();
ItemStack currentIngredient = recipe.getInput();
Class currentTool = recipe.getTool();
if (currentIngredient != null && currentTool != null) {
// currentTool.isAssignableFrom(toolStack.getItem().getClass()))
if (currentIngredient.getItem() == stack.getItem() && currentTool.isAssignableFrom(toolStack.getItem().getClass())) {
if (currentIngredient.getItemDamage() == stack.getItemDamage()) {
if (recipe.getRecipeOutput() != null) {
HarderStart.log.log(org.apache.logging.log4j.Level.INFO, "getValidRecipe: " + recipe.getRecipeOutput()[0]);
return recipe.getRecipeOutput();
}
}
}
}
}
return null;
}
Example 42
Project: HikariCP-master File: ConnectionRaceConditionTest.java View source code |
@Test
public void testRaceCondition() throws Exception {
HikariConfig config = new HikariConfig();
config.setMinimumIdle(0);
config.setMaximumPoolSize(10);
config.setInitializationFailFast(false);
config.setConnectionTimeout(2500);
config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");
TestElf.setSlf4jLogLevel(ConcurrentBag.class, Level.INFO);
final AtomicReference<Exception> ref = new AtomicReference<>(null);
// Initialize HikariPool with no initial connections and room to grow
try (final HikariDataSource ds = new HikariDataSource(config)) {
ExecutorService threadPool = Executors.newFixedThreadPool(2);
for (int i = 0; i < 500_000; i++) {
threadPool.submit(new Callable<Exception>() {
/** {@inheritDoc} */
@Override
public Exception call() throws Exception {
if (ref.get() != null) {
Connection c2;
try {
c2 = ds.getConnection();
ds.evictConnection(c2);
} catch (Exception e) {
ref.set(e);
}
}
return null;
}
});
}
threadPool.shutdown();
threadPool.awaitTermination(30, TimeUnit.SECONDS);
if (ref.get() != null) {
LoggerFactory.getLogger(ConnectionRaceConditionTest.class).error("Task failed", ref.get());
Assert.fail("Task failed");
}
} catch (Exception e) {
throw e;
}
}
Example 43
Project: lazydoc-master File: LazyDoc.java View source code |
public void document(Config config, List printerConfigs, String logLevel) throws Exception {
this.config = config;
this.reporter = new DocumentationReporter();
this.dataTypeParser = new DataTypeParser(reporter, config);
this.springParser = new SpringParser(config, reporter, dataTypeParser);
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
LoggerConfig loggerConfig = ctx.getConfiguration().getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
loggerConfig.setLevel(Level.getLevel(logLevel));
ctx.updateLoggers();
springParser.parseSpringControllers();
if (printerConfigs != null) {
for (PrinterConfig printerConfig : (List<PrinterConfig>) printerConfigs) {
printerConfig.setDomains(springParser.getDomains());
printerConfig.setDataTypes(dataTypeParser.getDataTypes());
printerConfig.setListOfCommonErrors(springParser.getListOfCommonErrors());
printerConfig.setOutputPath(printerConfig.getOutputPath());
DocumentationPrinter printer = (DocumentationPrinter) Class.forName(printerConfig.getClassName()).newInstance();
printer.print(printerConfig);
}
}
reporter.printOverallProgressReport();
if (config.isBreakOnUndocumented() && reporter.getUndocumentedCount() > 0) {
throw new RuntimeException("There are undocumented methods, errorhandlers or fields. Please see report.");
}
}
Example 44
Project: Mariculture-master File: MaricultureAPI.java View source code |
/** Use this helped method to determine if a module is enabled
* It's probably a good idea to cache this value for yourself **/
public static boolean isModuleEnabled(String name) {
try {
return (Boolean) Class.forName("joshie.mariculture.modules.ModuleManager").getMethod("isModuleEnabled", String.class).invoke(null, name);
} catch (ClassNotFoundExceptionNoSuchMethodException | IllegalAccessException | InvocationTargetException | e) {
logger.log(Level.ERROR, "Could not find the isModuleEnabled method");
}
//Default Return
return false;
}
Example 45
Project: Mekanism-master File: BCLog.java View source code |
public static void logErrorAPI(Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); msg.append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 46
Project: MinecraftForkage-master File: ForgeMessage.java View source code |
@Override
void fromBytes(ByteBuf bytes) {
int listSize = bytes.readInt();
for (int i = 0; i < listSize; i++) {
String fluidName = ByteBufUtils.readUTF8String(bytes);
int fluidId = bytes.readInt();
fluidIds.put(FluidRegistry.getFluid(fluidName), fluidId);
}
if (bytes.isReadable()) {
for (int i = 0; i < listSize; i++) {
defaultFluids.add(ByteBufUtils.readUTF8String(bytes));
}
} else {
FMLLog.getLogger().log(Level.INFO, "Legacy server message contains no default fluid list - there may be problems with fluids");
defaultFluids.clear();
}
}
Example 47
Project: MinecraftSecondScreenMod-master File: Logger.java View source code |
public static void e(String tag, String msg, Throwable t) {
String stacktrace = "";
PrintStream p;
try {
p = new PrintStream(stacktrace);
t.printStackTrace(p);
} catch (FileNotFoundException e1) {
stacktrace = t.getMessage();
}
log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: " + t.getClass().getCanonicalName() + "\nStacktrace: " + stacktrace + "\nMessage: " + t.getMessage());
}
Example 48
Project: NEI-Integration-master File: FuelManager.java View source code |
/** * Register the amount of heat in a bucket of liquid fuel. * * @param fluid * @param heatValuePerBucket */ public static void addBoilerFuel(Fluid fluid, int heatValuePerBucket) { ModContainer mod = Loader.instance().activeModContainer(); String modName = mod != null ? mod.getName() : "An Unknown Mod"; if (fluid == null) { FMLLog.log("Railcraft", Level.WARN, String.format("An error occured while %s was registering a Boiler fuel source", modName)); return; } boilerFuel.put(fluid, heatValuePerBucket); FMLLog.log("Railcraft", Level.DEBUG, String.format("%s registered \"%s\" as a valid Boiler fuel source with %d heat.", modName, fluid.getName(), heatValuePerBucket)); }
Example 49
Project: Progression-master File: TemplateHandler.java View source code |
public static void init() { //Load in the tabs Collection<File> files = FileUtils.listFiles(FileHelper.getTemplatesFolder("tab", null), new String[] { "json" }, false); for (File file : files) { try { String json = FileUtils.readFileToString(file); DataTab tab = JSONLoader.getGson().fromJson(json, DataTab.class); if (tab != null) { Progression.logger.log(Level.INFO, "Loaded in the template for the criteria: " + tab.getName()); registerTab(tab); } } catch (Exception e) { e.printStackTrace(); } } //Load in the criteria //Load in the tabs files = FileUtils.listFiles(FileHelper.getTemplatesFolder("criteria", null), new String[] { "json" }, false); for (File file : files) { try { String json = FileUtils.readFileToString(file); DataCriteria criteria = JSONLoader.getGson().fromJson(json, DataCriteria.class); if (criteria != null) { Progression.logger.log(Level.INFO, "Loaded in the template for the criteria: " + criteria.getName()); registerCriteria(criteria); } } catch (Exception e) { e.printStackTrace(); } } }
Example 50
Project: ProjectAres-master File: LoggingCommands.java View source code |
@Command(aliases = "level", desc = "Set or reset the level of a logger, or all loggers", usage = "<reset|off|severe|warning|info|config|fine|finer|finest|all> [jul|l4j] [root | <logger name>]", min = 1, max = 3) public void level(CommandContext args, CommandSender sender) throws CommandException, SuggestException { String levelName = args.getString(0).toUpperCase(); boolean jul = true, l4j = true; if (args.argsLength() >= 2) { String subsystem = args.getString(1).toLowerCase(); if ("jul".equals(subsystem)) { l4j = false; } else if ("l4j".equals(subsystem)) { jul = false; } } String loggerName = loggerNameArg(args, jul && l4j ? 1 : 2); if (jul) { Logger julLogger = Logging.findLogger(loggerName); if (julLogger != null) { Level level; if ("RESET".equals(levelName)) { level = null; } else { level = Level.parse(levelName); } julLogger.setLevel(level); sender.sendMessage(ChatColor.WHITE + "Logger " + loggerName(julLogger) + " level " + (level == null ? "reset" : "set to " + colorLevelName(level))); return; } } if (l4j) { org.apache.logging.log4j.Logger l4jLogger = Logging.L4J.findLogger(loggerName); if (l4jLogger != null) { org.apache.logging.log4j.Level level = org.apache.logging.log4j.Level.valueOf(levelName); Logging.L4J.setLevel(l4jLogger, level); sender.sendMessage(ChatColor.WHITE + "Logger " + l4jLogger.getName() + " level " + (level == null ? "reset" : "set to " + colorLevelName(level))); return; } } throw new CommandException("No logger named '" + loggerName + "'"); }
Example 51
Project: Railcraft-API-master File: FuelManager.java View source code |
/** * Register the amount of heat in a bucket of liquid fuel. * * @param fluid * @param heatValuePerBucket */ public static void addBoilerFuel(Fluid fluid, int heatValuePerBucket) { ModContainer mod = Loader.instance().activeModContainer(); String modName = mod != null ? mod.getName() : "An Unknown Mod"; if (fluid == null) { FMLLog.log("Railcraft", Level.WARN, String.format("An error occured while %s was registering a Boiler fuel source", modName)); return; } boilerFuel.put(fluid, heatValuePerBucket); FMLLog.log("Railcraft", Level.DEBUG, String.format("%s registered \"%s\" as a valid Boiler fuel source with %d heat.", modName, fluid.getName(), heatValuePerBucket)); }
Example 52
Project: raven-java-master File: SentryAppenderFailuresTest.java View source code |
@Test
public void testRavenFailureDoesNotPropagate() throws Exception {
new NonStrictExpectations() {
{
mockRaven.sendEvent((Event) any);
result = new UnsupportedOperationException();
}
};
sentryAppender.append(new Log4jLogEvent(null, null, null, Level.INFO, new SimpleMessage(""), null));
assertThat(mockUpErrorHandler.getErrorCount(), is(1));
}
Example 53
Project: RedstoneDistortion-master File: BCLog.java View source code |
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder(mod); msg.append(" API error, please update your mods. Error: ").append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg = new StringBuilder(mod); msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 54
Project: SAPManagerPack-master File: ModInitHelperInst.java View source code |
@SuppressWarnings("unchecked") public static ModInitHelperInst loadWhenModAvailable(String modId, String helperClass) { if (modId == null || modId.isEmpty()) { ManPackLoadingPlugin.MOD_LOG.printf(Level.FATAL, "Cannot check for null/empty mod ID!"); throw new RuntimeException(); } if (Loader.isModLoaded(modId)) { try { Class helperClassInst = Class.forName(helperClass); if (IModInitHelper.class.isAssignableFrom(helperClassInst)) { IModInitHelper inst = (IModInitHelper) helperClassInst.getConstructor().newInstance(); ManPackLoadingPlugin.MOD_LOG.printf(Level.INFO, "Mod %s is available. Initialized compatibillity class %s.", modId, helperClass); return new ModInitHelperInst(inst); } else { ManPackLoadingPlugin.MOD_LOG.printf(Level.ERROR, "Class %s is not a subclass of IModInitHelper! This is a serious modder error!", helperClass); throw new RuntimeException(); } } catch (ClassNotFoundExceptionInvocationTargetException | IllegalAccessException | InstantiationException | NoSuchMethodException | e) { ManPackLoadingPlugin.MOD_LOG.printf(Level.ERROR, "Unexpected exception while trying to build instance of compatibility class!"); return new ModInitHelperInst(new EmptyModInitHelper()); } } else { ManPackLoadingPlugin.MOD_LOG.printf(Level.INFO, "Mod %s is unavailable. Skipping initialization of compatibility class %s!", modId, helperClass); return new ModInitHelperInst(new EmptyModInitHelper()); } }
Example 55
Project: sky-walking-master File: AkkaSystem.java View source code |
public ActorSystem create() {
Level logLevel = logger.getLevel();
final Config config = ConfigFactory.parseString("akka.remote.netty.tcp.HOSTNAME=" + ClusterConfig.Cluster.Current.HOSTNAME).withFallback(ConfigFactory.parseString("akka.remote.netty.tcp.PORT=" + ClusterConfig.Cluster.Current.PORT)).withFallback(ConfigFactory.parseString("akka.loggers=[\"akka.event.slf4j.Slf4jLogger\"]")).withFallback(ConfigFactory.parseString("akka.loglevel=\"" + logLevel.name() + "\"")).withFallback(ConfigFactory.load("application.conf"));
if (!StringUtil.isEmpty(ClusterConfig.Cluster.SEED_NODES)) {
config.withFallback(ConfigFactory.parseString("akka.cluster.seed-nodes=" + generateSeedNodes()));
}
return ActorSystem.create(Const.SYSTEM_NAME, config);
}
Example 56
Project: SteamAdvantage-master File: Villages.java View source code |
public static void init() {
if (initDone)
return;
Entities.init();
try {
VillagerTradeHelper.insertTrades(3, 3, 1, new EntityVillager.ListItemForEmeralds(Items.steam_governor, new EntityVillager.PriceInfo(-4, -1)));
VillagerTradeHelper.insertTrades(3, 2, 1, new EntityVillager.ListItemForEmeralds(Items.steam_governor, new EntityVillager.PriceInfo(-4, -1)));
VillagerTradeHelper.insertTrades(3, 1, 1, new EntityVillager.ListItemForEmeralds(Items.steam_governor, new EntityVillager.PriceInfo(-4, -1)));
VillagerTradeHelper.insertTrades(1, 1, 1, new EntityVillager.ListItemForEmeralds(Items.steam_governor, new EntityVillager.PriceInfo(-4, -1)));
VillagerTradeHelper.insertTrades(1, 1, 1, new EntityVillager.ListItemForEmeralds(Item.getItemFromBlock(Blocks.steam_pipe), new EntityVillager.PriceInfo(-8, -4)));
VillagerTradeHelper.insertTrades(3, 2, 1, new EntityVillager.ListItemForEmeralds(Items.blackpowder_cartridge, new EntityVillager.PriceInfo(-7, -5)));
VillagerTradeHelper.insertTrades(3, 2, 1, new EntityVillager.ListItemForEmeralds(Items.blackpowder_musket, new EntityVillager.PriceInfo(10, 15)));
VillagerTradeHelper.insertTrades(3, 3, 1, new EntityVillager.ListItemForEmeralds(Items.blackpowder_cartridge, new EntityVillager.PriceInfo(-7, -5)));
VillagerTradeHelper.insertTrades(3, 3, 1, new EntityVillager.ListItemForEmeralds(Items.blackpowder_musket, new EntityVillager.PriceInfo(10, 15)));
VillagerTradeHelper.insertTrades(2, 1, 3, new EntityVillager.ListEnchantedItemForEmeralds(Items.blackpowder_musket, new EntityVillager.PriceInfo(15, 25)));
} catch (NoSuchFieldExceptionIllegalAccessException | e) {
FMLLog.log(Level.ERROR, e, "Failed to add trades to villagers");
}
initDone = true;
}
Example 57
Project: Tank-master File: TestParamUtilTest.java View source code |
@BeforeTest
public void before() {
LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration config = ctx.getConfiguration();
config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME).setLevel(Level.INFO);
// This causes all Loggers to refetch information from their LoggerConfig.
ctx.updateLoggers();
}
Example 58
Project: UniversalCore-master File: BCLog.java View source code |
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder(mod); msg.append(" API error, please update your mods. Error: ").append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg = new StringBuilder(mod); msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 59
Project: vsminecraft-master File: BCLog.java View source code |
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) { StringBuilder msg = new StringBuilder(mod); msg.append(" API error, please update your mods. Error: ").append(error); StackTraceElement[] stackTrace = error.getStackTrace(); if (stackTrace.length > 0) { msg.append(", ").append(stackTrace[0]); } logger.log(Level.ERROR, msg.toString()); if (classFile != null) { msg = new StringBuilder(mod); msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation()); logger.log(Level.ERROR, msg.toString()); } }
Example 60
Project: WildAnimalsPlus-1.7.10-master File: ForgeMessage.java View source code |
@Override
void fromBytes(ByteBuf bytes) {
int listSize = bytes.readInt();
for (int i = 0; i < listSize; i++) {
String fluidName = ByteBufUtils.readUTF8String(bytes);
int fluidId = bytes.readInt();
fluidIds.put(FluidRegistry.getFluid(fluidName), fluidId);
}
if (bytes.isReadable()) {
for (int i = 0; i < listSize; i++) {
defaultFluids.add(ByteBufUtils.readUTF8String(bytes));
}
} else {
FMLLog.getLogger().log(Level.INFO, "Legacy server message contains no default fluid list - there may be problems with fluids");
defaultFluids.clear();
}
}
Example 61
Project: glowroot-master File: Log4j2xAspect.java View source code |
@OnBefore
public static LogAdviceTraveler onBefore(ThreadContext context, @BindReceiver Logger logger, @SuppressWarnings("unused") @BindParameter @Nullable String fqcn, @BindParameter @Nullable Level level, @SuppressWarnings("unused") @BindParameter @Nullable Object marker, @BindParameter @Nullable Message message, @BindParameter @Nullable Throwable t) {
String formattedMessage = message == null ? "" : nullToEmpty(message.getFormattedMessage());
int lvl = level == null ? 0 : level.intLevel();
if (LoggerPlugin.markTraceAsError(lvl <= ERROR, lvl <= WARN, t != null)) {
context.setTransactionError(formattedMessage, t);
}
String loggerName = LoggerPlugin.getAbbreviatedLoggerName(logger.getName());
TraceEntry traceEntry = context.startTraceEntry(MessageSupplier.create("log {}: {} - {}", getLevelStr(lvl), loggerName, formattedMessage), timerName);
return new LogAdviceTraveler(traceEntry, lvl, formattedMessage, t);
}
Example 62
Project: monsiaj-master File: PDFPanel.java View source code |
public void load(File file) {
try {
page = null;
pagenum = 1;
RandomAccessFile raf = new RandomAccessFile(file, "r");
FileChannel channel = raf.getChannel();
ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
pdffile = new PDFFile(buf);
page = pdffile.getPage(pagenum);
page.waitForFinish();
} catch (Exception ex) {
logger.catching(org.apache.logging.log4j.Level.WARN, ex);
}
showPage();
}
Example 63
Project: AdvancedMod-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 64
Project: AMCore-master File: UpdateCheckThread.java View source code |
@Override public void run() { l: try { String id = _mod.getModName(); ModVersion ourVer = ModVersion.parse(id, _mod.getModVersion()); URL versionFile = new URL(_releaseUrl); BufferedReader reader = new BufferedReader(new InputStreamReader(versionFile.openStream())); ModVersion newVer = ModVersion.parse(id, reader.readLine()); ModVersion critVer = ModVersion.parse(id, reader.readLine()); reader.close(); if (newVer == null) { break l; } _newVer = newVer; _newVerAvailable = ourVer.compareTo(newVer) < 0; if (_newVerAvailable) { _mod.getLogger().info("An updated version of " + _mod.getModName() + " is available: " + newVer + "."); if (ourVer.minecraftVersion().compareTo(newVer.minecraftVersion()) < 0) { ReleaseVersion newv = newVer.minecraftVersion(), our = ourVer.minecraftVersion(); _newVerAvailable = newv.major() == our.major() && newv.minor() == our.minor(); } if (critVer != null && ourVer.compareTo(critVer) >= 0) { _criticalUpdate = Boolean.parseBoolean(critVer.description()); _criticalUpdate &= _newVerAvailable; } } if (_criticalUpdate) { _mod.getLogger().info("This update has been marked as CRITICAL and will ignore notification suppression."); } } catch (Exception e) { Level level = Level.WARN; String base = _mod.getClass().getPackage().getName(); int i = base.indexOf('.'); if (i > 0) { base = base.substring(0, i); } if (base.equals("cofh") || base.equals("powercrystals") || base.equals("advancedmods")) { level = Level.ERROR; } _mod.getLogger().log(level, AbstractLogger.CATCHING_MARKER, "Update check for " + _mod.getModName() + " failed.", e); } _checkComplete = true; }
Example 65
Project: Augury-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 66
Project: Chisel-2-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 67
Project: CopperTools-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 68
Project: core-ng-project-master File: ESLoggerConfigFactory.java View source code |
public static void bindLogger() {
LoggerContext context = (LoggerContext) LogManager.getContext(false);
Configuration config = context.getConfiguration();
Map<String, ESLogger> loggers = Maps.newConcurrentHashMap();
PatternLayout layout = PatternLayout.createLayout(PatternLayout.SIMPLE_CONVERSION_PATTERN, null, config, null, null, true, true, null, null);
Appender appender = new AbstractAppender("", null, layout) {
@Override
public void append(LogEvent event) {
String name = event.getLoggerName();
ESLogger logger = loggers.computeIfAbsent(name, key -> new ESLogger(key, null, (LoggerImpl) LoggerFactory.getLogger(key)));
logger.log(event.getLevel(), event.getMarker(), event.getMessage(), event.getThrown());
}
};
appender.start();
config.addAppender(appender);
LoggerConfig loggerConfig = LoggerConfig.createLogger(false, Level.ALL, "", "true", new AppenderRef[0], null, config, null);
loggerConfig.addAppender(appender, null, null);
config.addLogger("", loggerConfig);
context.updateLoggers();
}
Example 69
Project: DeepResonance-master File: CommonProxy.java View source code |
private void readMainConfig() {
Configuration cfg = mainConfig;
try {
cfg.load();
cfg.addCustomCategoryComment(WorldGenConfiguration.CATEGORY_WORLDGEN, "Configuration for wodlgen");
cfg.addCustomCategoryComment(GeneratorConfiguration.CATEGORY_GENERATOR, "Configuration for the generator multiblock");
cfg.addCustomCategoryComment(RadiationConfiguration.CATEGORY_RADIATION, "Configuration for the radiation");
cfg.addCustomCategoryComment(LaserBonusConfiguration.CATEGORY_LASERBONUS, "Configuration for the laser bonuses");
WorldGenConfiguration.init(cfg);
GeneratorConfiguration.init(cfg);
RadiationConfiguration.init(cfg);
LaserBonusConfiguration.init(cfg);
} catch (Exception e1) {
FMLLog.log(Level.ERROR, e1, "Problem loading config file!");
} finally {
if (mainConfig.hasChanged()) {
mainConfig.save();
}
}
}
Example 70
Project: dynunit-master File: ApacheLogListener.java View source code |
@Override
public void logEvent(final LogEvent logEvent) {
if (logEvent == null) {
return;
}
final Logger logger = getLoggerForEvent(logEvent);
final Level level = getLoggingLevelForEvent(logEvent);
final String message = logEvent.getMessage();
final Throwable exception = logEvent.getThrowable();
logger.log(level, message, exception);
}
Example 71
Project: Electrometrics-master File: UpdateThread.java View source code |
@Override
public void run() {
try {
// This is our current locally used version.
ModVersion ourVersion = ModVersion.parse(mod.getModName(), MinecraftForge.MC_VERSION + "-" + mod.getModVersion());
// Fetch the new version from the internet.
URL versionFile = new URL(releaseUrl);
BufferedReader reader = new BufferedReader(new InputStreamReader(versionFile.openStream()));
newModVersion = ModVersion.parse(mod.getModName(), reader.readLine());
ModVersion criticalVersion = ModVersion.parse(mod.getModName(), reader.readLine());
reader.close();
isNewVersionAvailable = ourVersion.compareTo(newModVersion) < 0;
if (isNewVersionAvailable) {
Electrometrics.getLogger().info("An updated version of " + mod.getModName() + " is available: " + newModVersion + ".");
if (ourVersion.getMinecraftVersion().compareTo(newModVersion.getMinecraftVersion()) < 0) {
ReleaseVersion newReleaseVersion = newModVersion.getMinecraftVersion();
ReleaseVersion ourReleaseVersion = ourVersion.getMinecraftVersion();
isNewVersionAvailable = newReleaseVersion.getMajor() == ourReleaseVersion.getMajor() && newReleaseVersion.getMinor() == ourReleaseVersion.getMinor();
}
if (criticalVersion != null && ourVersion.compareTo(criticalVersion) >= 0) {
isCriticalUpdate = Boolean.parseBoolean(criticalVersion.getDescription());
isCriticalUpdate &= isNewVersionAvailable;
}
}
if (isCriticalUpdate) {
Electrometrics.getLogger().info("This update has been marked as CRITICAL and will ignore notification suppression.");
}
// VersionChecker integration.
if (Integration.isVersionCheckerEnabled) {
NBTTagCompound nbtTagCompound = new NBTTagCompound();
nbtTagCompound.setString("modDisplayName", mod.getModName());
nbtTagCompound.setString("oldVersion", ourVersion.toString());
nbtTagCompound.setString("newVersion", newModVersion.toString());
if (downloadUrl != null) {
nbtTagCompound.setString("updateUrl", downloadUrl);
nbtTagCompound.setBoolean("isDirectLink", false);
}
FMLInterModComms.sendRuntimeMessage(mod.getModId(), "VersionChecker", "addUpdate", nbtTagCompound);
isNewVersionAvailable &= isCriticalUpdate;
}
} catch (Exception e) {
Electrometrics.getLogger().log(Level.WARN, AbstractLogger.CATCHING_MARKER, "Update check for " + mod.getModName() + " failed.", e);
}
isCheckCompleted = true;
}
Example 72
Project: EnderIO-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 73
Project: ExtraTools-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 74
Project: FlowstoneEnergy-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 75
Project: ForbiddenMagic-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 76
Project: FutureCraft-master File: SpaceRegistry.java View source code |
private static void registerPlanet(Planet provider) {
int id = dimensionIndex;
try {
BiomePlanet biome = provider.type.getBiome().getDeclaredConstructor(int.class, Planet.class).newInstance(id, provider);
biomes.put(provider, biome);
} catch (Exception e) {
e.printStackTrace();
}
try {
} catch (Exception e) {
FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, "An error occurred while registering a planet id: " + id);
throw new RuntimeException(e);
}
DimensionManager.registerProviderType(id, WorldProviderPlanet.class, false);
DimensionManager.registerDimension(id, id);
planets.put(id, provider);
ids.put(provider, id);
dimensionIndex++;
}
Example 77
Project: Http_Server_and_Proxy-master File: LoggerManager.java View source code |
/** * Sets current log level. * * @param newLogLevel the new log level * * @return the current log level */ public static boolean setCurrentLogLevel(String newLogLevel) { LoggerContext ctx = (LoggerContext) LogManager.getContext(false); Configuration config = ctx.getConfiguration(); LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); loggerConfig.setLevel(Level.toLevel(newLogLevel, Level.ERROR)); ctx.updateLoggers(); LoggerManager.currentLogLevel = loggerConfig.getLevel().toString(); if (LoggerManager.currentLogLevel.equalsIgnoreCase(newLogLevel)) { LOGGER.log(Level.toLevel(LoggerManager.currentLogLevel), "Logger Level was changed to => " + LoggerManager.currentLogLevel); return true; } else { return false; } }
Example 78
Project: IlluminatedBows-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 79
Project: ImLookingAtBlood-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 80
Project: ISAAC-master File: ActiveTasksTicker.java View source code |
//~--- methods -------------------------------------------------------------
/**
* Start.
*
* @param intervalInSeconds the interval in seconds
*/
public static void start(int intervalInSeconds) {
ticker.start(intervalInSeconds, ( tick) -> {
final Set<Task<?>> taskSet = Get.activeTasks().get();
taskSet.stream().forEach(( task) -> {
double percentProgress = task.getProgress() * 100;
if (percentProgress < 0) {
percentProgress = 0;
}
log.printf(org.apache.logging.log4j.Level.INFO, "%n %s%n %s%n %.1f%% complete", task.getTitle(), task.getMessage(), percentProgress);
});
});
}
Example 81
Project: LogIt-master File: Log4jFilter.java View source code |
public void register() { Logger rootLogger = (Logger) LogManager.getRootLogger(); rootLogger.addFilter(new Filter() { @Override public Result filter(LogEvent event) { if (!commandSilencer.isFiltersRegistered()) return Result.NEUTRAL; if (event.getMessage().getFormattedMessage() == null) return Result.NEUTRAL; if (!event.getLoggerName().endsWith(".PlayerConnection")) return Result.NEUTRAL; Matcher matcher = commandSilencer.getMatcherForMsg(event.getMessage().getFormattedMessage()); if (matcher.find()) { String username = matcher.group(1); String label = matcher.group(2); Player player = PlayerUtils.getPlayer(username); // typed e.g. "/logni 1234" instead of "/login 1234". if (!getSessionManager().isSessionAlive(player) && getCore().isPlayerForcedToLogIn(player)) { return Result.DENY; } if (commandSilencer.isCommandSilenced(label)) { return Result.DENY; } } return Result.NEUTRAL; } @Override public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) { return Result.NEUTRAL; } @Override public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) { return Result.NEUTRAL; } @Override public Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) { return Result.NEUTRAL; } @Override public Result getOnMismatch() { return Result.NEUTRAL; } @Override public Result getOnMatch() { return Result.NEUTRAL; } }); }
Example 82
Project: MateriaMuto-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 83
Project: MatterOverdrive-master File: MatterNetworkComponentClientDispatcher.java View source code |
@Override public int onNetworkTick(World world, TickEvent.Phase phase) { super.onNetworkTick(world, phase); if (phase.equals(dispatchPhase)) { for (int i = 0; i < getTaskQueueCount(); i++) { if (getTaskQueue(i).peek() != null) { try { return manageTopQueue(world, i, getTaskQueue(i).peek()); } catch (Exception e) { MatterOverdrive.log.log(Level.ERROR, e, "Where was a problem while trying to get task from Queue from %s", getClass()); try { getTaskQueue(i).dequeue(); } catch (Exception e1) { MatterOverdrive.log.log(Level.ERROR, e1, "Could not deque bad task from dispatcher!"); getTaskQueue(i).clear(); } } } } } return 0; }
Example 84
Project: MHFC-master File: RenderPaintball.java View source code |
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTick) {
IIcon iicon = this.item.getIconFromDamage(0);
if (entity instanceof EntityPaintball && iicon != null) {
EntityPaintball entityPaintball = (EntityPaintball) entity;
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.bindEntityTexture(entity);
Tessellator tessellator = Tessellator.instance;
ItemColor itemColor = entityPaintball.getColor();
Color color = new Color(itemColor.getColor());
GL11.glColor3f(color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F);
this.renderToTesselator(tessellator, iicon);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
} else {
MHFCMain.logger().log(Level.INFO, "Unable to render Paintball.");
}
}
Example 85
Project: MinecraftForge-master File: FMLFolderResourcePack.java View source code |
@Override
protected InputStream getInputStreamByName(String resourceName) throws IOException {
try {
return super.getInputStreamByName(resourceName);
} catch (IOException ioe) {
if ("pack.mcmeta".equals(resourceName)) {
FMLLog.log(container.getName(), Level.DEBUG, "Mod %s is missing a pack.mcmeta file, substituting a dummy one", container.getName());
return new ByteArrayInputStream(("{\n" + " \"pack\": {\n" + " \"description\": \"dummy FML pack for " + container.getName() + "\",\n" + " \"pack_format\": 2\n" + "}\n" + "}").getBytes(Charsets.UTF_8));
} else
throw ioe;
}
}
Example 86
Project: ModularArmour-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 87
Project: MULE-master File: DispatchingLoggerTestCase.java View source code |
@Before
public void before() {
currentClassLoader = Thread.currentThread().getContextClassLoader();
when(loggerContext.getConfiguration().getLoggerConfig(anyString()).getLevel()).thenReturn(Level.INFO);
logger = new DispatchingLogger(originalLogger, currentClassLoader.hashCode(), loggerContext, contextSelector, messageFactory) {
@Override
public String getName() {
return LOGGER_NAME;
}
};
}
Example 88
Project: MysticalTrinkets-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 89
Project: PlayBlock-master File: SharedConfiguration.java View source code |
/** * Save the properties to a file. */ public void save() { try { props.store(new FileOutputStream(options), null); } catch (FileNotFoundException e) { PlayBlock.log(Level.WARN, "Failed to find " + options.getName()); } catch (IOException e) { PlayBlock.log(Level.WARN, "Failed to save " + options.getName()); } }
Example 90
Project: PneumaticCraft-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 91
Project: Quantum-Anomalies-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 92
Project: ShadowsOfPhysis-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 93
Project: SpeedyTools-master File: ErrorLog.java View source code |
/** sends all messages to the given logfile, does not copy to console
*
* @param logfilename
*/
public static void setLogFileAsDefault(String logfilename) {
Logger logger = LogManager.getLogger("Default");
// logger.setLevel(Level.INFO);
// FileHandler fileTxt;
// try {
// fileTxt = new FileHandler(logfilename);
// } catch (IOException e) {
// setDefaultErrorLogger(logger);
// return;
// }
// fileTxt.setFormatter(new SimpleFormatter());
// for (Handler handler : logger.getHandlers()) {
// logger.removeHandler(handler);
// }
// logger.addHandler(fileTxt);
// logger.setUseParentHandlers(false);
setDefaultErrorLogger(logger);
}
Example 94
Project: StorageDrawers-master File: CountUpdateMessage.java View source code |
@Override
public void fromBytes(ByteBuf buf) {
try {
x = buf.readInt();
y = buf.readShort();
z = buf.readInt();
slot = buf.readByte();
count = buf.readInt();
} catch (IndexOutOfBoundsException e) {
failed = true;
FMLLog.log(StorageDrawers.MOD_ID, Level.ERROR, e, "CountUpdateMessage: Unexpected end of packet.\nMessage: %s", ByteBufUtil.hexDump(buf, 0, buf.writerIndex()));
}
}
Example 95
Project: Thaumic-NEI-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 96
Project: TLS-Attacker-master File: ConfigHandler.java View source code |
/** * Initializes TLS Attacker according to the config file. In addition, it * adds the Bouncy Castle provider and removes the PKCS#11 security provider * since there are some problems when handling ECC. * * @param config */ public void initialize(GeneralConfig config) { // ECC does not work properly in the NSS provider Security.removeProvider("SunPKCS11-NSS"); Security.addProvider(new BouncyCastleProvider()); LOGGER.debug("Using the following security providers"); for (Provider p : Security.getProviders()) { LOGGER.debug("Provider {}, version, {}", p.getName(), p.getVersion()); } LoggerContext ctx = (LoggerContext) LogManager.getContext(false); Configuration ctxConfig = ctx.getConfiguration(); LoggerConfig loggerConfig = ctxConfig.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); if (config.isDebug()) { loggerConfig.setLevel(Level.DEBUG); ctx.updateLoggers(); } else if (config.isQuiet()) { loggerConfig.setLevel(Level.OFF); ctx.updateLoggers(); } else if (config.getLogLevel() != null) { loggerConfig.setLevel(config.getLogLevel()); ctx.updateLoggers(); } UnlimitedStrengthHelper.removeCryptoStrengthRestriction(); }
Example 97
Project: TPPI-Tweaks-master File: ResearchCategories.java View source code |
public static void addResearch(ResearchItem ri) {
ResearchCategoryList rl = getResearchList(ri.category);
if (rl != null && !rl.research.containsKey(ri.key)) {
if (!ri.isVirtual()) {
for (ResearchItem rr : rl.research.values()) {
if (rr.displayColumn == ri.displayColumn && rr.displayRow == ri.displayRow) {
FMLLog.log(Level.FATAL, "[Thaumcraft] Research [" + ri.getName() + "] not added as it overlaps with existing research [" + rr.getName() + "]");
return;
}
}
}
rl.research.put(ri.key, ri);
if (ri.displayColumn < rl.minDisplayColumn) {
rl.minDisplayColumn = ri.displayColumn;
}
if (ri.displayRow < rl.minDisplayRow) {
rl.minDisplayRow = ri.displayRow;
}
if (ri.displayColumn > rl.maxDisplayColumn) {
rl.maxDisplayColumn = ri.displayColumn;
}
if (ri.displayRow > rl.maxDisplayRow) {
rl.maxDisplayRow = ri.displayRow;
}
}
}
Example 98
Project: Abyss-master File: DisruptionHandler.java View source code |
/**
* Registers a Disruption Entry
* @param disruption The Disruption
*
* @since 1.5
*/
public void registerDisruption(DisruptionEntry disruption) {
for (DisruptionEntry entry : disruptions) if (disruption.getUnlocalizedName().equals(entry.getUnlocalizedName())) {
FMLLog.log("DisruptionHandler", Level.ERROR, "Disruption Entry already registered: %s", disruption.getUnlocalizedName());
return;
}
disruptions.add(disruption);
}
Example 99
Project: AbyssalCraft-master File: DisruptionHandler.java View source code |
/**
* Registers a Disruption Entry
* @param disruption The Disruption
*
* @since 1.5
*/
public void registerDisruption(DisruptionEntry disruption) {
for (DisruptionEntry entry : disruptions) if (disruption.getUnlocalizedName().equals(entry.getUnlocalizedName())) {
FMLLog.log("DisruptionHandler", Level.ERROR, "Disruption Entry already registered: %s", disruption.getUnlocalizedName());
return;
}
disruptions.add(disruption);
}
Example 100
Project: ApplicationInsights-Java-master File: ApplicationInsightsLogEventTest.java View source code |
private static void testSeverityLevel(final Level level, SeverityLevel expected) { org.apache.logging.log4j.core.LogEvent logEvent = new LogEvent() { @Override public Map<String, String> getContextMap() { return null; } @Override public ThreadContext.ContextStack getContextStack() { return null; } @Override public String getLoggerFqcn() { return null; } @Override public Level getLevel() { return level; } @Override public String getLoggerName() { return null; } @Override public Marker getMarker() { return null; } @Override public Message getMessage() { return null; } @Override public long getTimeMillis() { return 0; } @Override public StackTraceElement getSource() { return null; } @Override public String getThreadName() { return null; } @Override public Throwable getThrown() { return null; } @Override public ThrowableProxy getThrownProxy() { return null; } @Override public boolean isEndOfBatch() { return false; } @Override public boolean isIncludeLocation() { return false; } @Override public void setEndOfBatch(boolean endOfBatch) { } @Override public void setIncludeLocation(boolean locationRequired) { } }; ApplicationInsightsLogEvent event = new ApplicationInsightsLogEvent(logEvent); assertEquals(expected, event.getNormalizedSeverityLevel()); }
Example 101
Project: BBTweaks-master File: EventHandler.java View source code |
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onGuiOpen(GuiOpenEvent event) {
if (event.getGui() instanceof GuiMainMenu && !BBTweaks.played) {
BBTweaks.played = true;
if (BBTweaks.playOn == 1 || BBTweaks.playOn == 3) {
SoundEvent sound = (SoundEvent) SoundEvent.REGISTRY.getObject(new ResourceLocation(BBTweaks.name));
if (sound.getSoundName() != null) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(sound, (float) BBTweaks.pitch));
} else {
FMLLog.log("BBTweaks", Level.WARN, "Could not find sound: %s", new Object[] { new ResourceLocation(BBTweaks.name) });
}
}
}
}