question

Upvotes
Accepted
1 2 2 2

How to configure logging file location for RDP in Python?

I am setting up a new application using python and the RDP library to get snapshot data. Logging output from the RDP library is ignoring my application logger and output is send to the root of my project directory. How can I redirect the logging information to store this in a different directory?

pythonlogging
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
25.1k 87 11 24

Hi @Merijn

I can confirm that this issue has been fixed in the latest a10 release:

refinitiv-dataplatform · PyPI

See attached example config file - you will need to rename it to .json

rdplibconfig.prod.txt

You can use the conventional Windows path format as per the attached file or forward slash e.g. "c:/temp/rdp-lib.log"


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.1k 87 11 24

Hi @Merijn

Sorry for the delay, I was trying to investigate this.

You are meant to be able to configure this via a json config file - but at the moment it is not working. If you try to change the folder location it fails - only allows changing the filename...

It would be using the attached file renamed .json.
I have asked the Dev team to update me when the issue is fixed so I can let you know.


rdplibconfig.prod.txt


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
15 0 0 2
Hi @umer.nalla , Thanks for this. Do you have a small example how I would add this json configuration to my code?
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.1k 87 11 24

Hi @VFM

You can place the above JSON file into the working directory of your Jupyter notebook or python script and the RDP library should detect and act on it.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25.1k 87 11 24

Hi @VFM

If you need to place the JSON file in a different file/folder, you can use the following workaround:

import refinitiv.dataplatform as rdp
config = rdp.configure.config
test_config = rdp.configure.ext_config_mod.config_from_json(
    "c:\\Refinitiv\\RDP.Python\\my-config.json",
    read_from_file=True,
    )
config.update(test_config)

rdp.log._log_file_handler = rdp.log._create_log_file_handler()


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
15 0 0 2

Thanks Umer, this works fine for us. This way I am able to keep 2 log files - one for the RDP and one for the applicaiton, seperate.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.