Kikaha uses SLF4J as its main log implementation. It means you can use any logging service that is compatible with SLF4J as you logging implementation.
Bellow a sample code using the core API.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// http://www.slf4j.org/manual.html
public class HelloWorld {
private static final
Logger logger = LoggerFactory.getLogger(HelloWorld.class);
public static void main(String[] args) {
logger.info("Hello World");
}
}
If you are a Lombok user, you will have a more clean HelloWorld code.
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class HelloWorld {
public static void main(String[] args) {
log.info("Hello World");
}
}
On the first run of your HelloWorld sample you will face the following warning message.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
This is a simple message printed from SLF4j warning you that only its api (slf4j-api
) was present in the classpath. If you have followed the Getting Started guide or included the kikaha-project
module on your maven project (as parent or at dependencyManagement), just include one of the following on your dependencies
.
<!-- Simple Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</dependency>
<!-- Log4J -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<!-- Logback -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
For more logging options or details please consult the SLF4j manual.
WELCOME About Kikaha philosophy
GETTING STARTED Getting started in 1 minute Creating a Kikaha maven project Architecture overview
TUTORIALS Logging configuration Configuring the server Creating your first HTTP route Kikaha's command line interface Configuring your favorite IDE Wro4j Integration
CORE FEATURES HTTP and HTTPS Routing static assets Dependency injection Authentication and authorization Smart routes
ESSENTIAL MODULES μRouting API WebSocket Routing Database Connection Pool JSON with Jackson Protobuf Mustache Templates Rocker Templates BCrypt
CLOUD MODULES Overview of Cloud Modules Consul.io Codahale's Metrics Auth0 Single Sign-On μWorkers - Actor-like API Hazelcast
AWS-RELATED MODULES Overview of AWS-Related Modules Deploying Applications on AWS AWS IAM Credentials AWS EC2 AWS SQS queues AWS CloudWatch metrics AWS Application Load Balancer AWS Lambda functions AWS X-Ray
ADVANCED TOPICS Creating custom modules Routing with Undertow's API Creating custom cloud modules