dockware
Search…
Pimp my Log
Logs are very important. And we know about the frustration when not being able to access it easily. And that's why every dockware images comes with an installed Pimp my Log log viewer.
Open the log viewer in your web browser with /logs of the domain you use:
pimp my log - main view
Switch between different prepared logs, such as Apache error logs, access logs as well as Shopware logs for either production or development.
pimp my log - change log

Add custom logs

Dockware has been prepared to show the Shopware and Apache default logs. But what if you want to add custom log files from your shop or the plugin you are developing?
That's easy too!
Let's imagine you create a new plugin with a custom log file. That one has probably the name of your plugin, as well as the environment and probably datetime.
You can add your custom log file, by simply adding a new JSON configuration to Pimp my Log. Do this, by mounting your own file into the folder /var/www/pimpmylog/config.user.d as shown here:
1
version: "3.0"
2
3
services:
4
5
shop:
6
image: dockware/dev:latest
7
volume:
8
- "./pimpmylog/my_plugin.json:/var/www/pimpmylog/config.user.d/my_plugin.json"
Copied!
The content of the file can just look like this. It has the name that will be used in the web application, a path to your log file using a pattern expression, and information about the way how your log line is structured.
This is a sample that parses the following type of log entry.
Datetime
Severity
Error Message
File
Line
1
{
2
"my_plugin": {
3
"display" : "My Plugin Logs",
4
"path" : "/var/www/html/var/logs/my_plugin_*.log",
5
"notify": false,
6
"format" : {
7
"multiline": "",
8
"regex" : "@\\[(.*?)\\]\\s*?\\w*\\.(.*?):\\s?((.*?)\\s*?(?:at|in)\\s*?(.*?)\\s*?(?:on line|line)\\s*([0-9]*).*?|(.*?))[email protected]",
9
"match" : {
10
"Date" : 1,
11
"Severity" : 2,
12
"Error" : [3,4],
13
"File" : 5,
14
"Line" : 6
15
},
16
"types" : {
17
"Date" : "date:m-d H:i:s",
18
"Severity" : "badge:severity",
19
"File" : "pre:\/-69",
20
"Line" : "numeral",
21
"Error" : "pre"
22
}
23
}
24
}
25
}
Copied!
You can find more examples on the Pimp my Log website.
Here is a video that shows you how it would look like.

Logging with Apps

Logging is far more interesting when it comes to decentralized systems, such as with the ones you'll be building when creating Shopware Apps.
If you are not logging using Filebeats and an ELK system (Elastic - Logstash - Kibana), then you are probably in the need of seing your log files from your backend service.
This can easily be done with the built-in Pimp my Log application of your Shopware container. Please keep in mind, this is only an easy approach to reuse that application. We still recommend a dedicated container and setup for perfect logging across different containers.
Sending your logs from your backend service to your Shopware container is easy. We can just use bind-mounting for that log folder. So we get the log folder onto our host machine (step 1), and then pass that on to the Shopware container by bind-mounting it to any folder inside that container (step 2). Please use an empty directory somewhere in the Shopware container.
If you do not want to use the local host with bind-mounting, you can also use simple volume mounting or anything else. Just make sure that folder is connected to both containers.
1
version: "3.0"
2
3
services:
4
5
shop:
6
image: dockware/dev:latest
7
volumes:
8
# step 2: add log folder to container from host
9
- "./src/service_logs:/var/www/logs/backend_service"
10
# step 3: add pimp my log configuration for new folder
11
- "./pimpmylog/service.json:/var/www/pimpmylog/config.user.d/service.json"
12
13
service:
14
image: dockware/flex:latest
15
volumes:
16
# step 1: get container log folder on host
17
- "./service_logs:/var/www/html/my_used_log_folder"
18
19
volumes:
20
volume_logs:
21
external: false
Copied!
Now you have successfully connected the logs from the backend service with the folder inside your Shopware container.
The next thing is, to correctly configured our additional configuration JSON for Pimp my Log, which is already mounted into the Shopware container too (step 3). This snippet only focuses on the display name and path. Please see the example above for a full code snippet.
1
{
2
"backend_service": {
3
"display" : "Backend Service Logs",
4
"path" : "/var/www/logs/backend_service/*.log",
5
...
6
}
7
}
Copied!
That's it!
If you now start your containers, you should already see a filter "Backend Service Logs" in Pimp my Log, and logs should be visible, if existing.