Logging ignored?

Hi guys,

I am trying to provide a log-file for metabase as pointed out on:

However, it seems that the provided parameters are ignored:
No logfile shows up at the provided path.

I am starting metabase as a SystemD service:

[Unit]
Description=Metabase
Documentation=Metabase documentation

[Service]
WorkingDirectory=/home/metabase
EnvironmentFile=/home/metabase/metabase.env
ExecStart=/usr/lib/jvm/jdk1.8.0_131/bin/java -Dlog4j.configurationFile=file:/home/metabase/log4j2.xml -Dlogfile.path=/home/metabase -Xms256m -Xmx1024m -jar metabase.jar
User=metabase
Type=simple
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=metabase
SuccessExitStatus=143
TimeoutStopSec=120

[Install]
WantedBy=multi-user.target

The log4j2.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Root level="WARN">
  <AppenderRef ref="FILE"/>
</Root>

I cannot see, what would be the problem here. Any ideas anybody maybe?

Thx and kind regards,

Tom

Hi @Tom_S
Which version of Metabase?
Are you trying to log with syslog or log4j file? If log4j, then you would need to uncomment the RollingFile-section:
https://github.com/metabase/metabase/blob/master/resources/log4j2.xml

Hi @flamber,

thx for your reply.
Indeed I am using the log4j approach.
Just noticed that discourse killed some parts of my pasted xml.
Retrying it now:

<?xml version="1.0" encoding="UTF-8"?>
<Root level="WARN">
  <AppenderRef ref="FILE"/>
</Root>

Now without further formatting...

...Crap, seems for some reason the XML Tags vanish.


Now as image :wink:

@Tom_S
Post “Diagnostic Info” from Admin > Troubleshooting.

If you use code formatting (</> button in the editor), then the forum wouldn’t strip tags.

But if you are using a systemd service, then why not just use syslog instead. They are very connected.

Hi @flamber,

{
“browser-info”: {
“language”: “de”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0”,
“vendor”: “”
},
“system-info”: {
“file.encoding”: “ANSI_X3.4-1968”,
“java.runtime.name”: “Java™ SE Runtime Environment”,
“java.runtime.version”: “1.8.0_131-b11”,
“java.vendor”: “Oracle Corporation”,
“java.vendor.url”: “http://java.oracle.com/”,
“java.version”: “1.8.0_131”,
“java.vm.name”: “Java HotSpot™ 64-Bit Server VM”,
“java.vm.version”: “25.131-b11”,
“os.name”: “Linux”,
“os.version”: “4.4.0-193-generic”,
“user.language”: “en”,
“user.timezone”: “Europe/Berlin”
},
“metabase-info”: {
“databases”: [
“mysql”
],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“application-database-details”: {
“database”: {
“name”: “H2”,
“version”: “1.4.197 (2018-03-18)”
},
“jdbc-driver”: {
“name”: “H2 JDBC Driver”,
“version”: “1.4.197 (2018-03-18)”
}
},
“run-mode”: “prod”,
“version”: {
“tag”: “v1.36.4”,
“date”: “2020-08-19”,
“branch”: “enterprise-release-1.36.x”,
“hash”: “0324e9c”
},
“settings”: {
“report-timezone”: “Europe/Berlin”
}
}
}

That´s the output of the diagostic information.
My idea of using log4x instead of syslog would be to have the possibility to get daily logging and size-limited log-files (and dedicated output to one known/defined file)

Kind regards,

Tom

@Tom_S The log4j was upgraded to v2 in Metabase x.37.0 - that’s why it’s not working, since you are using a different format.
Either follow this - or upgrade to latest release, 1.37.4
https://www.metabase.com/docs/v0.36.4/operations-guide/log-configuration.html

It’s possible to have daily and size-limited logs with syslog - that’s kinda what it was created for. There are a lot of guides for syslog on the internet, which goes well outside the scope of Metabase.

Also upgrade Java: https://www.metabase.com/docs/latest/operations-guide/java-versions.html

And migrate away from H2 if you’re using Metabase in production:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

Hi @flamber,
indeed it seems I have to push my admin to adapt syslog configuration… it was setup a rather quick&dirty way it seems.
Regarding database: yes, this is just a test-bed, production instance will be based on MySQL in the end.

Thx for pointing out the different log4j-versions between these updates, that pretty much explains why I had a hard time figuring what´s going on. :slight_smile:
Kind regards,

Tom