1

I observed that it is not printing the complete log line information when python logging module used.

Is there a option to print full log length using python logging module

3
  • What do you mean "printing"? How is the logging set up? Are you talking about the terminal? In a file? Something else? What were you expecting, and what did you get instead? We can't read your mind; as it stands, you've provided nowhere near enough information. Commented May 21, 2015 at 14:50
  • Do you mean more details in every log line apart from the message that you specify? Those are LogRecord attributes which are referenced in docs.python.org/2/library/logging.html#logrecord-attributes Commented May 21, 2015 at 14:56
  • Show us your code plz. Commented May 21, 2015 at 15:10

1 Answer 1

1

The OP's question is unclear, so this may be off topic, but since there are no answers here and this is the top google hit for what I thought I wanted to know...

I ended up here because I was "logging" a pandas dataframe through the logging module and it wasn't using the full terminal size. At first I thought it was the logging module that needed configuration changes for longer line length, but actually it is really just how pandas formats a dataframe when it is printed as a string.

The problem is not with the logging module having a line length limit or needing any configuration. Pandas rather has display configuration options, and you want to set those.

So if you were doing

LOG.info(df)

and wanted that to use the full terminal width, you need to do

pd.set_option('display.width', None)

somewhere ahead of time. Setting the display width to None or 0 causes pandas to autodetect the terminal size. Otherwise, set it to the integer value of your desired maximum line length. Note that all of this formatting on your screen has nothing to do with the logging module. The logging module is just receiving one really long string, and pandas has formatted it for display on a terminal, and the

LOG.info(df)

is outputting just a single log entry though it may span multiple lines.

Maybe that helps someone who ended up here the same way I did.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.