本文整理汇总了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;
}
示例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;
}
示例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");
}
示例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");
}
}
示例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();
}
示例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());
}
}
示例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();
}
示例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();
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
}