import com.github.garygaoworks.gfc.logging.Logger; import com.github.garygaoworks.gfc.logging.LoggerFactory; public class MyClass { private static final Logger LOGGER = LoggerFactory.getLogger(MyClass.class); public static void main(String[] args) { // Set logging level to INFO LOGGER.setLevel(Logger.Level.INFO); // Log an info message LOGGER.info("This is an info message"); // Log a warning message LOGGER.warn("This is a warning message"); // Log an error message with an exception stack trace try { throw new NullPointerException("Null pointer exception"); } catch (NullPointerException e) { LOGGER.error("An error occurred", e); } } }


上一篇:
下一篇:
切换中文