当前位置: 首页>>代码示例>>Java>>正文


Java Logger.error方法代码示例

本文整理汇总了Java中org.pmw.tinylog.Logger.error方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.error方法的具体用法?Java Logger.error怎么用?Java Logger.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pmw.tinylog.Logger的用法示例。


在下文中一共展示了Logger.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listExamples

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public List<File> listExamples(final File folder) {
	Configurator.defaultConfig()
	   .writer(new FileWriter(logFile))
	   .level(Level.INFO)
	   .activate();
	Logger.error("ENTER LIST EXAMPLES");
	List<File> directories = new ArrayList<File> (); 
    for (final File fileEntry : folder.listFiles()) {
		Logger.error("Listando"+ fileEntry.getAbsolutePath());
        if (fileEntry.isDirectory()) {
            directories.add(fileEntry);
        }
    }
	Logger.error("EXIT LIST EXAMPLES");
    return directories;
}
 
开发者ID:mgbiedma,项目名称:java-heap-analyzer-api,代码行数:17,代码来源:ExamplesService.java

示例2: getUser

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Path("/{id}")
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public User getUser(@PathParam("id") int id) {
        try {
            BeanFactory factory = new ClassPathXmlApplicationContext();
            UserService userService = (UserService) factory.getBean("userService");
            User user = userService.GetUser(id);
            return user;

        } catch (Exception e) {
            Logger.error(e.toString());
//            return "Exception:"+e.toString()+". msg:"+e.getMessage()+". trace:"+e.getStackTrace();
        }
        return null;
    }
 
开发者ID:xujiajun,项目名称:tastjava,代码行数:17,代码来源:UserResource.java

示例3: main

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {

		// source coude generate level tag
		final String preLevelTag = "[[preLevelTag]]";
		final String postLevelTag = "[[postLevelTag]]";

		// for "1 default example" and "2 log-level decoration example" (see tinylog.properties) 
		Logger.trace("hello trace-world");
		Logger.debug("hello debug-world");
		Logger.info("hello info-world");
		Logger.warn("hello warn-world");
		//		Logger.warn("hello warn-world with {}source code generated{} 'misuse' of the level tag", preLevelTag, postLevelTag);
		Logger.error("hello error-world");


		// for "3 custom tag usage example" (see tinylog.properties)
		//		Logger.info("Example 1 - sequential tag replacement:   [[someCustomPreTag]] some text [[someCustomPostTag]] and possibly some other text");
		//		Logger.info("Example 2 - coloring of tag occurrence:   ----- pre-init (phase 1) ----- and possibly some other text");
		//		Logger.info("Example 3 - coloring within a tag:        <---- init (phase 2) ----> and possibly some other text");
		//		Logger.info("Example 4 - coloring of tagged content:   <==== init DONE ====> and possibly some other text");
		//		Logger.info("Example 5 - coloring or arbitrary strings: UNCAUGHT EXCEPTION: error in some class");
	}
 
开发者ID:tobiasrm,项目名称:tinylog-coloredconsole,代码行数:23,代码来源:Main.java

示例4: handleDirectRemotePacket

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private void handleDirectRemotePacket(final DatagramPacket packet) {
    if (clientPort == -1) {
        //We don't know client port yet
        return;
    }

    final byte[] address = packet.getAddress().getAddress();
    final AddressType addressType = address.length == 4 ? AddressType.IPv4 : AddressType.IPv6;

    final SOCKS5UDPRelayHeader socks5UDPRelayHeader = new SOCKS5UDPRelayHeader(addressType, address,
            packet.getPort(), Arrays.copyOf(packet.getData(), packet.getLength()));
    final byte[] sendBytes = socks5UDPRelayHeader.toBytes();

    final DatagramPacket localPacket = new DatagramPacket(sendBytes, sendBytes.length,
            new InetSocketAddress(clientAddress, clientPort));

    try {
        datagramSocket.send(localPacket);
    } catch (final IOException e) {
        Logger.error(e, "Failed to send UDP relay packet to client");
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:23,代码来源:ProxyClientUDPRelay.java

示例5: ProxyServer

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public ProxyServer(final ProxyServerConfig config) throws SocketException {
    this.bindAddress = config.getBindAddress();
    this.limitMbps = config.getMbpsLimit();
    this.welcomeMessage = config.getWelcomeMessage();
    this.allowLoopback = config.isAllowLoopback();
    this.packetCryptor = config.getDragoniteSocketParameters().getPacketCryptor();

    this.dragoniteServer = new DragoniteServer(bindAddress.getAddress(), bindAddress.getPort(),
            ProxyGlobalConstants.INIT_SEND_SPEED, config.getDragoniteSocketParameters());

    acceptThread = new Thread(() -> {
        try {
            DragoniteSocket socket;
            while (doAccept && (socket = dragoniteServer.accept()) != null) {
                Logger.debug("New client from {}", socket.getRemoteSocketAddress().toString());
                handleClient(socket);
            }
        } catch (final InterruptedException e) {
            Logger.error(e, "Unable to accept Dragonite connections");
        }
    }, "PS-Accept");
    acceptThread.start();
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:24,代码来源:ProxyServer.java

示例6: handleRemotePacket

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private void handleRemotePacket(final DatagramPacket packet) {
    if (clientPort == -1) {
        //We don't know client port yet
        return;
    }

    final byte[] address = packet.getAddress().getAddress();
    final AddressType addressType = address.length == 4 ? AddressType.IPv4 : AddressType.IPv6;

    final ProxyUDPRelayHeader relayHeader = new ProxyUDPRelayHeader(addressType, address, packet.getPort(),
            Arrays.copyOf(packet.getData(), packet.getLength()));
    final byte[] relayHeaderBytes = relayHeader.toBytes();

    final byte[] sendBytes = packetCryptor.encrypt(relayHeaderBytes);

    final DatagramPacket localPacket = new DatagramPacket(sendBytes, sendBytes.length,
            new InetSocketAddress(clientAddress, clientPort));

    try {
        datagramSocket.send(localPacket);
    } catch (final IOException e) {
        Logger.error(e, "Failed to send UDP relay packet to \"{}\" ({})",
                clientName, clientAddress.toString());
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:26,代码来源:ProxyServerUDPRelay.java

示例7: ForwarderClient

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public ForwarderClient(final ForwarderClientConfig config) throws IOException, InterruptedException, DragoniteException, IncorrectHeaderException, ServerRejectedException {
    this.remoteAddress = config.getRemoteAddress();
    this.localPort = config.getLocalPort();
    this.downMbps = config.getDownMbps();
    this.upMbps = config.getUpMbps();
    this.dragoniteSocketParameters = config.getDragoniteSocketParameters();

    serverSocket = new ServerSocket(localPort);

    prepareUnderlyingConnection(dragoniteSocketParameters);

    acceptThread = new Thread(() -> {
        Socket socket;
        try {
            while (doAccept && (socket = serverSocket.accept()) != null) {
                handleConnection(socket);
            }
        } catch (final IOException e) {
            Logger.error(e, "Unable to accept TCP connections");
        }
    }, "FC-Accept");
    acceptThread.start();
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:24,代码来源:ForwarderClient.java

示例8: ForwarderServer

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public ForwarderServer(final ForwarderServerConfig config) throws SocketException {
    this.bindAddress = config.getBindAddress();
    this.forwardingAddress = config.getForwardingAddress();
    this.limitMbps = config.getMbpsLimit();
    this.welcomeMessage = config.getWelcomeMessage();

    this.dragoniteServer = new DragoniteServer(bindAddress.getAddress(), bindAddress.getPort(),
            ForwarderGlobalConstants.INIT_SEND_SPEED, config.getDragoniteSocketParameters());

    acceptThread = new Thread(() -> {
        try {
            DragoniteSocket socket;
            while (doAccept && (socket = dragoniteServer.accept()) != null) {
                Logger.debug("New client from {}", socket.getRemoteSocketAddress().toString());
                handleClient(socket);
            }
        } catch (final InterruptedException e) {
            Logger.error(e, "Unable to accept Dragonite connections");
        }
    }, "FS-Accept");
    acceptThread.start();
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:23,代码来源:ForwarderServer.java

示例9: main

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
	Collection<OutputDeviceInterface> one_target = Arrays.asList(value -> System.out.println(value));
	Collection<OutputDeviceInterface> two_targets = Arrays.asList(
			value -> System.out.println("1: " + value), value -> System.out.println("2: " + value));

	try {
		animate(one_target, 10, Elastic::easeOut, 1, "/animation1.json", "/animation3.json");
		animate(one_target, 10, Elastic::easeOut, 1, "/animation3.json");
		animate(two_targets, 100, Cubic::easeIn, 1, "/animation2.json");
	} catch (IOException e) {
		Logger.error(e, "Error: {}", e);
	} finally {
		// Required if there are non-daemon threads that will prevent the
		// built-in clean-up routines from running
		DeviceFactoryHelper.getNativeDeviceFactory().close();
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:18,代码来源:GsonAnimationTest.java

示例10: onMessage

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Override
public void onMessage(WebSocket conn, String message) {
    BrowserWebSocket browserWebSocket = clientMap.get(conn);
    if (browserWebSocket == null) {
        // No existing comms handler, check that this is the init event (it better be)
        try {
            JSONObject json = new JSONObject(message);
            if (json.has("event") && json.getString("event").equals("init")) {
                browserWebSocket = idMap.get(json.getInt("id"));
                if (browserWebSocket == null) {
                    Logger.error("Unknown BrowserCommsHandler for id {}", json.getString("id"));
                } else {
                    browserWebSocket.initConnection(conn, json);
                    clientMap.put(conn, browserWebSocket);
                }
            } else {
                Logger.error("No handler for connection {}", conn);
            }
        } catch (JSONException e) {
            Logger.error(e);
        }
    } else {
        browserWebSocket.onMessage(message);
    }
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:26,代码来源:BrowserWebSocketServer.java

示例11: start

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public void start(ProcessLauncher processLauncher) {
    File executable = engineContext.getChromeExecutable();
    if (executable == null) {
        throw new ScriptException("Unable to find Chrome executable.");
    }

    setupProfile();

    ArrayList<String> args = new ArrayList<>();
    args.add(executable.getAbsolutePath());
    buildArgs(args);

    Logger.info("Launching Chrome: {}", Joiner.join(args, " "));
    try {
        if (processLauncher == null) {
            ProcessBuilder builder = new ProcessBuilder(args);
            process = builder.start();
        } else {
            this.processLauncher = processLauncher;
            processLauncher.startBrowser(args);
        }
    } catch (IOException|InterruptedException e) {
        Logger.error(e);
    }
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:26,代码来源:ChromeProcess.java

示例12: main

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {
	if (args.length < 2) {
		Logger.error("Usage: {} <mcp-name> <chip-select> <adc-pin> [<temp-offset>]", TMP36Test.class.getName());
		System.exit(2);
	}
	McpAdc.Type type = McpAdc.Type.valueOf(args[0]);
	if (type == null) {
		Logger.error("Invalid MCP ADC type '{}'. Usage: {} <mcp-name> <spi-chip-select> <adc_pin>", args[0], McpAdcTest.class.getName());
		System.exit(2);
	}
	
	int chip_select = Integer.parseInt(args[1]);
	int adc_pin = Integer.parseInt(args[2]);
	float temp_offset = DEFAULT_TEMPERATURE_OFFSET;
	if (args.length > 2) {
		temp_offset = Float.parseFloat(args[2]);
	}
	float v_ref = 3.3f;
	test(type, chip_select, adc_pin, temp_offset, v_ref);
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:21,代码来源:TMP36Test.java

示例13: writeBytes

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public void writeBytes(int address, byte[] data) {
	if ((address + data.length) > type.getMemorySizeBytes()) {
		Logger.error("Attempt to write beyond memory size - no data written");
		return;
	}
	
	int page = address / type.getPageSizeBytes();
	int bytes_remaining = data.length;
	do {
		int remaining_page_size = type.getPageSizeBytes() - (address % type.getPageSizeBytes());
		int bytes_to_write = remaining_page_size < bytes_remaining ? remaining_page_size : bytes_remaining;
		
		byte[] addr_bytes = getAddressByteArray(address);
		byte[] buffer = new byte[addr_bytes.length+bytes_to_write];
		System.arraycopy(addr_bytes, 0, buffer, 0, addr_bytes.length);
		System.arraycopy(data, data.length - bytes_remaining, buffer, addr_bytes.length, bytes_to_write);
		device.write(buffer);
		
		bytes_remaining -= bytes_to_write;
		page++;
		address = page * type.getPageSizeBytes();
		
		SleepUtil.sleepMillis(type.getWriteCycleTimeMillis());
	} while (bytes_remaining > 0);
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:26,代码来源:McpEeprom.java

示例14: serverConfigFromConfigParser

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static ProxyServerConfig serverConfigFromConfigParser(final ProxyJSONConfigParser configParser) {
    try {
        return configParser.getServerConfig();
    } catch (final JSONConfigException e) {
        Logger.error(e, "Failed to parse config");
        return null;
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:9,代码来源:CLIMain.java

示例15: clientConfigFromConfigParser

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static ProxyClientConfig clientConfigFromConfigParser(final ProxyJSONConfigParser configParser) {
    try {
        return configParser.getClientConfig();
    } catch (final JSONConfigException e) {
        Logger.error(e, "Failed to parse config");
        return null;
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:9,代码来源:CLIMain.java


注:本文中的org.pmw.tinylog.Logger.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。