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


Java Logger类代码示例

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


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

示例1: loadResults

import org.pmw.tinylog.Logger; //导入依赖的package包/类
public void loadResults() {
    try {
        JSObject windowObj = (JSObject)webEngine.executeScript("window");
        ObjectMapper mapper = new ObjectMapper();
        String json = mapper.writeValueAsString(testResult);
        windowObj.setMember("result", json);
        try {
            webEngine.executeScript("refreshResult()");
        } catch (JSException js) {
            Logger.error(js, "error updating result");
        }

    } catch (JsonProcessingException e) {
        return;
    }
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:17,代码来源:ViewResultsPanel.java

示例2: 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

示例3: handle

import org.pmw.tinylog.Logger; //导入依赖的package包/类
@Override
public void handle(Context context) throws Exception {
    context.parse(Map.class).then(payload -> {
        Logger.info(QUERY + ": " + payload.get(QUERY));
        @SuppressWarnings("unchecked")
        Map<String, Object> variables = (Map<String, Object>) payload.get(VARIABLES);
        ExecutionInput executionInput = ExecutionInput.newExecutionInput()
                .query(payload.get(QUERY).toString())
                .variables(variables)
                .build();
        final ExecutionResult executionResult = graphql.execute(executionInput);
        Map<String, Object> result = new LinkedHashMap<>();
        if (executionResult.getErrors().isEmpty()) {
            result.put(DATA, executionResult.getData());
        } else {
            result.put(ERRORS, executionResult.getErrors());
            Logger.error("Errors: {}", executionResult.getErrors());
        }
        context.render(json(result));
    });
}
 
开发者ID:nwillc,项目名称:ratpack-graphql,代码行数:22,代码来源:GraphQLHandler.java

示例4: send

import org.pmw.tinylog.Logger; //导入依赖的package包/类
/**
 * Send datas on the socket
 * @param datas Datas to send
 * @throws YeelightSocketException when socket error occurs
 */
public void send(String datas) throws YeelightSocketException {
    try {
        Logger.debug("{} sent to {}:{}", datas, this.ip, this.port);
        this.socketWriter.write(datas);
        this.socketWriter.flush();
    } catch (Exception e) {
        throw new YeelightSocketException(e);
    }
}
 
开发者ID:florian-mollin,项目名称:yapi,代码行数:15,代码来源:YeelightSocketHolder.java

示例5: 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

示例6: 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

示例7: getArgs

import org.pmw.tinylog.Logger; //导入依赖的package包/类
private static String[] getArgs(final String[] cmdArgs) {
    final File argsFile = new File(ARGS_FILE_NAME);
    if (argsFile.canRead()) {
        try {
            final Scanner scanner = new Scanner(argsFile);
            final ArrayList<String> argsList = new ArrayList<>();
            while (scanner.hasNext()) {
                argsList.add(scanner.next());
            }
            scanner.close();
            Logger.info("Arguments loaded from file \"{}\"", ARGS_FILE_NAME);
            return argsList.toArray(new String[0]);
        } catch (final FileNotFoundException e) {
            Logger.warn(e, "Unable to load file \"{}\", using commandline arguments", ARGS_FILE_NAME);
            return cmdArgs;
        }
    } else {
        Logger.info("Using commandline arguments");
        return cmdArgs;
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:22,代码来源:CLIMain.java

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: getPinState

import org.pmw.tinylog.Logger; //导入依赖的package包/类
public PinState getPinState(int gpio) throws IOException {
	PinState pin_state = sendMessage(new byte[] { START_SYSEX, PIN_STATE_QUERY, (byte) gpio, END_SYSEX },
			PinState.class);

	// Update the cached pin mode and value
	Pin pin = pins.get(Integer.valueOf(gpio));
	if (pin == null) {
		Logger.warn("No such GPIO #{}", Integer.valueOf(gpio));
	} else {
		pin.setMode(pin_state.getMode());
		// For output modes, the state is any value that has been previously written to
		// the pin
		if (pin_state.getMode().isOutput()) {
			pin.setValue(pin_state.getState());
		}
	}

	return pin_state;
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:20,代码来源:FirmataAdapter.java

示例14: setShared

import org.pmw.tinylog.Logger; //导入依赖的package包/类
/**
 * populate the list of shared values from a given array
 */
public boolean setShared(List<String[]> shared){

    //iterate through list, adding
    ArrayList<String> lsSharedOptions = new ArrayList<String>();
    for(String[] line : shared){ //for each line in the shared file
        lsSharedOptions.add(line[0]); //option
        String[] toAdd = {line[0], line[1]};
        this.collection.lsShared.add(toAdd);

        Logger.trace("Added shared value '{}:{}'",line[0],line[1]);
    }

    //validate the set of shared values. if not validated, clear
    if(!isValidOptions(lsSharedOptions)){
        this.collection.lsShared.clear();
        Logger.warn("Collection-level warning: 'shared.csv' file is not accurately formatted or is empty");
        return false;
    }

    //already added
    return true;
}
 
开发者ID:lib-re,项目名称:dublin-core-text-parser,代码行数:26,代码来源:Parser.java

示例15: main

import org.pmw.tinylog.Logger; //导入依赖的package包/类
public static void main(String[] args) {
	int device_address = HD44780Lcd.PCF8574LcdConnection.DEFAULT_DEVICE_ADDRESS;
	if (args.length > 0) {
		device_address = Integer.decode(args[0]).intValue();
	}
	int controller = I2CConstants.BUS_1;
	if (args.length > 1) {
		controller = Integer.parseInt(args[1]);
	}
	
	int columns = 16;
	int rows = 2;
	
	// Initialise display
	try (LcdConnection lcd_connection = new PCF8574LcdConnection(controller, device_address);
			HD44780Lcd lcd = new HD44780Lcd(lcd_connection, columns, rows)) {
		LcdApp.test(lcd);
	} catch (RuntimeIOException 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,代码行数:26,代码来源:LcdApp.java


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