Git Product home page Git Product logo

Comments (5)

dthkao avatar dthkao commented on July 27, 2024 3

How about running with the --alsologtostderr flag?

from abseil-py.

mickeyh avatar mickeyh commented on July 27, 2024 2

You can get it working by specifying --log_dir=<log directory> on the commandline and adding to the beginning of your program something like:

import os

from absl import flags
from absl import logging

FLAGS = flags.FLAGS

...

if FLAGS.log_dir:
    if not os.path.exists(FLAGS.log_dir):
        os.makedirs(FLAGS.log_dir)
    logging.get_absl_handler().use_absl_log_file('2018_12_02_absl_logging', FLAGS.log_dir)

from abseil-py.

yilei avatar yilei commented on July 27, 2024 2

use_absl_log_file by default checks FLAGS.log_dir, so you can just do:

from absl import app
from absl import logging

def main(argv):
    if len(argv) > 1:
        raise app.UsageError('Too many command-line arguments.')
    logging.get_absl_handler().use_absl_log_file()

if __name__ == '__main__':
    app.run(main)

Feel free to re-open if you still have questions.

from abseil-py.

fuhailin avatar fuhailin commented on July 27, 2024

When set absl log file, I cannot get output from the screen, how to get output information from log file and sys.stdout both?

from abseil-py.

fuhailin avatar fuhailin commented on July 27, 2024

How about running with the --alsologtostderr flag?

Thank you very much, it works expectly

from abseil-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.