question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[KED-1258] Allow logging directory to be specified

See original GitHub issue

Description

It is very jarring for kedro to change directories on its users. It appears that this is done for logging purposes. Is there a way to specify the logging directory without changing the users directory? This is possibly related to #149.

https://github.com/quantumblacklabs/kedro/blob/c96e94dc46948b05d9d09e285894ba3ff03c2595/kedro/context/context.py#L518-L522

Context

It is very confusing to have a side effect of changing directories after running a function. This behavior is not typical with other python frameworks/libraries that I am familiar with.

Possible Implementation

set the logging directory and remove the os.chdir line.

logging.basicConfig(filename=str(project_path / log_filename), filemode='w')

Possible Alternatives

My project templates track the user’s directory and changes it back to where the user intended to be. This works, but is less desirable.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
WaylonWalkercommented, Mar 19, 2020

Great Work!!! Excited to see this in the next version. We have a quick hack implemented on our pipelines that simply saves the current directory, loads context, then changes back to where the user was.

It might be good to update run.py from the template to not rely on the user’s current working directory.

https://github.com/quantumblacklabs/kedro/blob/develop/kedro/template/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.python_package }}/run.py#L54

def run_package():
    # entry point for running pip-install projects
    # using `<project_package>` command
-   project_context = load_context(Path.cwd())
+   project_context = load_context(Path(__file__).parents[1]) # it might be a different layer of parents double check that
    project_context.run()
0reactions
limdautocommented, Mar 19, 2020

Great shout. Will definite make that change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[KED-1258] Allow logging directory to be specified · Issue #161
Description It is very jarring for kedro to change directories on its users. It appears that this is done for logging purposes. Is...
Read more >
JR46994: Allow alternative client log directory to be specified ...
Apply patch JR46994 which allows users to specify alternative log directory by specifying the path to the field "xmlui.logging.
Read more >
Chapter 7. Log File Reference Red Hat Directory Server 11
The access logs have different levels of logging, set in the nsslapd-accesslog-level attribute. The following sections provide an overview of the default ...
Read more >
Default Log File Settings for Web Sites <logFile> - IIS
For example, you can enable or disable logging, configure the format of the IIS log file, specify the categories of information to store...
Read more >
Changing the directory where log files are located - TechDocs
box, type the path to the new location for the log files. The file directory that you specify must already exist. Symantec Protection...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found