# \[Solved\] Nextcloud (snap) v12.0.4 cannot successfully change nextcloud.log location

**URL:** <https://help.nextcloud.com/t/solved-nextcloud-snap-v12-0-4-cannot-successfully-change-nextcloud-log-location/25479>\
**Category:** ℹ️ Support\
**Created:** [January 6, 2018, 5:22pm UTC](https://help.nextcloud.com/t/solved-nextcloud-snap-v12-0-4-cannot-successfully-change-nextcloud-log-location/25479 "2018-01-06T17:22:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spookywatcher](https://help.nextcloud.com/letter_avatar/spookywatcher/32/5_5575768a8748004e209b776fc1b2916d.png) [@spookywatcher](https://help.nextcloud.com/u/spookywatcher)\
**Post date:** [January 6, 2018, 5:22pm UTC](https://help.nextcloud.com/t/solved-nextcloud-snap-v12-0-4-cannot-successfully-change-nextcloud-log-location/25479/1 "2018-01-06T17:22:40Z")

</div>

Greetings…been working this problem for 2 days unsuccessfully with many hours of research but cannot fix.

I’m running v12.0.4 via snap install. So my nextcloud.log file is located in: /var/snap/nextcloud/common/nextcloud/data/nextcloud.log

I need it changed to /var/log/nextcloud.log because fail2ban cannot access the snap’s version location.

Steps I’ve done:

**sudo nextcloud.occ config:system:set log\_type --value=“owncloud”**

**sudo nextcloud.occ config:system:set logfile --value="/var/log/nextcloud.log"**

Everything looks great in config.php:

My code:

“\<?php  
$CONFIG = array (  
‘apps\_paths’ =\>  
array (  
0 =\>  
array (  
‘path’ =\> ‘/snap/nextcloud/current/htdocs/apps’,  
‘url’ =\> ‘/apps’,  
‘writable’ =\> false,  
),  
1 =\>  
array (  
‘path’ =\> ‘/var/snap/nextcloud/current/nextcloud/extra-apps’,  
‘url’ =\> ‘/extra-apps’,  
‘writable’ =\> true,  
),  
),  
‘supportedDatabases’ =\>  
array (  
0 =\> ‘mysql’,  
),  
‘memcache.locking’ =\> ‘\OC\Memcache\Redis’,  
‘memcache.local’ =\> ‘\OC\Memcache\Redis’,  
‘redis’ =\>  
array (  
‘host’ =\> ‘/tmp/sockets/redis.sock’,  
‘port’ =\> 0,  
),  
‘passwordsalt’ =\> ‘REDACTED-FOR-PRIVACEY’,  
‘secret’ =\> ‘REDACTED-FOR-PRIVACEY’,  
‘trusted\_domains’ =\>  
array (  
0 =\> ‘localhost’,  
1 =\> ‘REDACTED-FOR-PRIVACEY’,  
),  
‘datadirectory’ =\> ‘/var/snap/nextcloud/common/nextcloud/data’,  
‘overwrite.cli.url’ =\> ‘[http://localhost](http://localhost)’,  
‘dbtype’ =\> ‘mysql’,  
‘version’ =\> ‘12.0.4.3’,  
‘dbname’ =\> ‘nextcloud’,  
‘dbhost’ =\> ‘localhost:/tmp/sockets/mysql.sock’,  
‘dbport’ =\> ‘’,  
‘dbtableprefix’ =\> ‘oc\_’,  
‘dbuser’ =\> ‘nextcloud’,  
‘dbpassword’ =\> ‘REDACTED-FOR-PRIVACEY’,  
‘logtimezone’ =\> ‘UTC’,  
‘installed’ =\> true,  
‘instanceid’ =\> ‘oc1rz26caw2b’,  
‘loglevel’ =\> 2,  
‘maintenance’ =\> false,  
‘log\_type’ =\> ‘owncloud’,  
‘logfile’ =\> ‘/var/log/nextcloud.log’,  
);”

End My Code:

Of course I got an error log saying could not touch the /var/log/nextcloud.log due to permissions, so I did the next steps:

**sudo touch /var/log/nextcloud.log**  
**sudo chown www-data /var/log/nextcloud.log**

**ls -l /var/log/nextcloud.log** comes back with

**-rw-r–r-- 1 www-data root 0 Jan 6 08:24 /var/log/nextcloud.log**

All seems ok…tested by accessing nextcloud from untrusted domain (which always gives me a level 2) in the old log and by testing with a failed login. But nothing is being logged into /var/log/nextcloud.log

I’m stumped and out of guess and research. Any ideas?

Much appreciated…

Spooky

---

<div class="post-metadata">

**Author:** ![spookywatcher](https://help.nextcloud.com/letter_avatar/spookywatcher/32/5_5575768a8748004e209b776fc1b2916d.png) [@spookywatcher](https://help.nextcloud.com/u/spookywatcher)\
**Post date:** [January 6, 2018, 10:54pm UTC](https://help.nextcloud.com/t/solved-nextcloud-snap-v12-0-4-cannot-successfully-change-nextcloud-log-location/25479/2 "2018-01-06T22:54:42Z")

</div>

Had no idea snaps could not read or write to the file system other than in their snap wrapper.

So I changed the directory of the log to /var/snap/nextcloud/common/nextcloud/nextcloud.log

and changed the permissions…

Now everything is working.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 3, 2024, 9:07pm UTC](https://help.nextcloud.com/t/solved-nextcloud-snap-v12-0-4-cannot-successfully-change-nextcloud-log-location/25479/3 "2024-12-03T21:07:09Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 2:00pm UTC](https://help.nextcloud.com/t/solved-nextcloud-snap-v12-0-4-cannot-successfully-change-nextcloud-log-location/25479/4 "2024-12-09T14:00:52Z")

</div>


