Skip to content

Commit 1e280f3

Browse files
committed
Add info about Logging Fraction
1 parent fa84937 commit 1e280f3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: README.md

+22
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ public static void main(String[] args) throws Exception {
3232
container.deploy(deployment);
3333
```
3434

35+
To configure the logging appender responsible to collect the logs, we will add the Logging Fraction and define it as such
36+
37+
```
38+
container.fraction(new LoggingFraction()
39+
.fileHandler("swarm-camel", f -> {
40+
41+
Map<String, String> fileProps = new HashMap<>();
42+
fileProps.put("path", LOG_FILE);
43+
f.file(fileProps);
44+
f.level(Level.INFO);
45+
f.formatter("%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n");
46+
})
47+
.rootLogger(Level.INFO,"swarm-camel")
48+
);
49+
```
50+
51+
A FileHandler is defined with the name of the Logging file, the logging level and the format to be used to save the informations. To configure the Logging Api
52+
to use this appender for the root logger, we have also configured the rootLogger field with the id of the fileHandler created.
53+
3554
## Build
3655

3756
You will need to compile this example first:
@@ -105,6 +124,9 @@ Then find the name of the pod that runs this quickstart, and output the logs fro
105124

106125
You can also use the OpenShift web console to manage the running pods, and view logs and much more.
107126

127+
As we have mounted a Kubernetes Volume between the host and the linux container, you can also consult the content of the WildFly Swarm log file `/var/log/swarm.log` if you ssh to the
128+
virtual machine. If you use minishift, simply run this command `minishift ssh` to access it.
129+
108130
## Access services using a web browser
109131

110132
You can use any browser to perform a HTTP GET. This allows you to very easily test a few of the RESTful services we defined:

0 commit comments

Comments
 (0)