Skip to content
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

impossible to disable logging to file in start_service ? #358

Open
mknaw opened this issue Jul 20, 2023 · 2 comments
Open

impossible to disable logging to file in start_service ? #358

mknaw opened this issue Jul 20, 2023 · 2 comments

Comments

@mknaw
Copy link

mknaw commented Jul 20, 2023

please excuse my ignorance as I am new to the pact approach. perhaps there is something I am missing in the recommended workflow.

it seems like during normal local development, I may run my test suite without any interest in collecting pact-mock-service.log files

ultimately I suppose I could .gitignore these files in each consumer service... but it seems like it would be nice if I could provide something to pact constructor's log_dir or otherwise to opt out of the logging?
appears to be hardcoded in the start_service command currently

@YOU54F
Copy link
Member

YOU54F commented Jul 25, 2023

You are correct, it just isn't implemented as a feature.

It defaults to the current directory,

self.log_dir = log_dir or os.getcwd()

and then always applied to the underlying mock server cli call

"--log", f"{self.log_dir}/pact-mock-service.log",

contributions are welcome 👍🏾

@YOU54F
Copy link
Member

YOU54F commented Jul 25, 2023

The default workflow in the majority of our repos, bar where they are shown for demonstration purposes is to .gitignore the log files and pact files which are generated each run, so they are not committed to source.

I would imagine if you did have the option, you may want to configure it from the outside, rather than having to update your code, to provide you logging by file, in the case of troubleshooting.

Does it log the same to stdout, as provided in the log file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants