Java Apache2 Log File Permission Denied

506 Views Asked by At

I'm trying to read the apache2 custom log files in the /var/log/apache2/my_site/access.log in a Java program. But i get a permission denied Excpetion.

The code is working on the Winows OS, i can read the log file, but in Ubuntu, i cannot access the apache2 log files in the JVM. This is the output

output

The permissions snapshot

enter image description here

So how can i adjust the file permissions that i can read the file and Apache 2 still can write to it?

1

There are 1 best solutions below

0
Java User On BEST ANSWER

Fixed by changing the folder of the log file outside the /var/log/apache2 folder. Apache2 and JVM can both access the file in RW mode.