Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9234271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:45:04+00:00 2026-06-18T06:45:04+00:00

Running a module called log.py creates a file my_file.log where it logs at what

  • 0

Running a module called log.py creates a file my_file.log where it logs at what time the script ran. Running log.py (over)writes to a log file perfectly fine in my local project but for some reason running it on my production deploy in heroku doesn’t write to my_file.log. The log.py also does some other things and I can tell by that that log.py did indeed execute in Heroku. It’s only the logs that aren’t written.

First I thought it could be a permissions problem but checking with ls -l gives

drwx------ 3 my_app
-rw------- 1 my_file.log

The following is my project structure:

.
├── my_project
│   ├── my_app
│   │   ├── __init__.py
│   │   ├── models.py
│   │   ├── tests.py
│   │   ├── views.py
│   │   ├── my_file.log
│   │   └── management
│   │       ├── __init__.py
│   │       └── commands
│   │           ├── __init__.py
│   │           └── log.py
│   ├── __init__.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── manage.py
└── requirements.txt

It shouldn’t have anything to do with the code being used as a custom Django command because in my development version the log file is overwritten each time as it should.

This is the snippet in log.py responsible for logging to my_file.log:

log_lc = os.path.join(os.path.dirname(os.path.abspath(__file__)), 
  os.path.pardir, os.path.pardir, "my_file.log")
logging.basicConfig(filename=log_lc,level=logging.INFO,
  format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',
  filemode="w")

logging.info("You just ran my_file.log")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:45:05+00:00Added an answer on June 18, 2026 at 6:45 am

    Heroku is read-only. You are trying to create your own log file, my_file.log, and you will not be able to do that since you cannot write anything to their file system.

    You can, however, print log messages to Heroku’s standard logs. Here are the docs for that.. You could then check your messages via heroku logs.

    In addition to Heroku’s standard logging, they have many apps available for logging that you can install on your Heroku app. Otherwise, you could consider using an email option or writing your log file to a third party location like s3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long running process that is called via a Nancy Module Get
I'm getting this error after running my specs, i have a file called validations.rb
I'm running a Perl script through the subprocess module in Python on Linux. The
i want to create a module for my running application. I chose module, so
I am using the subprocess module to find out if a process is running.
I wrote a python module. Running python filename.py, only checks for syntax errors. Is
I am using the urllib2 module in Python 2.6.4, running in Windows XP, to
I have a JEE6 application, with an ejb and a web-module, running on a
Is there a way to use Log::Log4perl to make a smart self-logging module that
I have a simple module called MyModule.psm1 defined as function Show-Text($p) { Write-Host $p

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.