Skip to content

Using embedded Proxy input_args breaks logging/stdout #1336

Open
@klmunday

Description

@klmunday

I am currently creating an application which embeds proxy.py with a custom plugin.
Due to requiring custom flags within the custom plugin I am having to use the workaround detailed in #871 in order for them to parse correctly.

I have noticed that since implementing this workaround that I am no longer getting any logs/stdout from the proxy.

Simplified version of my code below.

def run_proxy() -> None:    
    proxy_py_args = [
        "--plugin", "<my plugin>",
        "--disable-headers", "Via"
    ]
    with proxy.Proxy(
            port=9000,
            input_args=proxy_py_args
    ) as p:
        logging.info(f"starting proxy at {p.flags.hostname}:{p.flags.port}")
        print(p.flags)
        proxy.sleep_loop()

I do not see the message from logging.info in stdout. However, I do see the print. I have tried specifying a log-file which seems to parse correctly into p.flags but it does not get written to.

However, when I run the following I see the regular logging/stdout.

def run_proxy() -> None:
    with proxy.Proxy(
            port=9000,
            plugins=["<plugin name>"]
    ) as _:
        proxy.sleep_loop()

This however breaks the parsing of the custom plugins flags (as detailed in #871) so this is not a solution.

I have also tried using proxy.main instead, then specifying my args via command line but that has not worked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug report in proxy serverGood First IssueIssues for new contributors to pick-up

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions