Skip to content

Fixes #2501 - Make temporary logfile location platform independent. #2502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import json
import os
import sys
import tempfile
import urlparse

import requests
Expand Down Expand Up @@ -134,11 +135,16 @@ def update_status_config(milestones_content):
# it will create a line with the following format
# 2015-09-14 20:50:19,185 INFO: Thing_To_Log [in /codepath/views.py:127]

LOG_FILE = '/tmp/webcompat.log'
# set the tempdir to somewhere predictable, no matter the platform
tempfile.tempdir = os.path.join(os.getcwd(), 'tmp')
print('Writing logs to: {}'.format(tempfile.gettempdir()))

LOG_FILE = os.path.join(tempfile.gettempdir(), 'webcompat.log')

This comment was marked as abuse.

if STAGING:
LOG_FILE = '/tmp/staging-webcompat.log'
LOG_FILE = os.path.join(tempfile.gettempdir(), 'staging-webcompat.log')
LOG_FMT = '%(asctime)s tracking %(message)s'
CSP_REPORTS_LOG = '/tmp/webcompat-csp-reports.log'
CSP_REPORTS_LOG = os.path.join(
tempfile.gettempdir(), 'webcompat-csp-reports.log')

# Status categories used in the project
# 'new', 'needsdiagnosis', 'needscontact', 'contactready' , 'sitewait', 'close'
Expand Down
15 changes: 10 additions & 5 deletions docs/dev-env-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ You can now edit `secrets.py` and

![Auth 404](https://i.cloudup.com/8FDA5bVc7l.png)

### Updating __init__.py file

Make sure `tmp` folder is updated with `temp` for Windows

### Starting The Server

```bash
Expand All @@ -207,7 +203,16 @@ You should now have a local instance of the site running at `http://localhost:50
#### Getting error messages?

Please [file bugs](https://github.com/webcompat/webcompat.com/issues/new) in case you need further assistance.
First you should have a look at the logs. They are located at `/tmp/webcompat.log` (Linux/Mac) or `/temp/webcompat.log` (Windows).
First you should have a look at the logs located in `webcompat.com/tmp`.

When you start the local server, it will also print the location to the console:

```bash
> python run.py
Statuses Initialization…
Writing logs to: /Users/acooluser/projects/webcompat.com/tmp

This comment was marked as abuse.

```


### Building the Project
Expand Down