Coder Social home page Coder Social logo

Comments (2)

afparsons avatar afparsons commented on July 18, 2024 1

Aha! I guess stdout is directed to /dev/null?

See the "printf tracing" section available here: https://shiny.rstudio.com/articles/debugging.html

Also see this StackOverflow question: https://stackoverflow.com/questions/33912150/how-can-i-get-standard-output-written-to-a-log-file-when-a-shiny-app-is-deployed.

Since I was using the logging [GitHub] package, I added a handler to the root logger.

# logging level DEBUG
logging::basicConfig(level = 10)
    
# write logging output to the stderr file
logging::addHandler(writeToFile, logger = '', file = stderr())

However, I switched to logger [GitHub], as it appears to be more feature-rich and more-frequently maintained. The idea is the same:

# set the logger level
logger::log_threshold(INFO)

# direct the logger to write to stderr, since shiny only logs stderr
logger::log_appender(logger::appender_file(file = stderr()))

One could also just use R's base::cat(), like so:

base::cat(file = stderr(), 'my string', toString(some_variable), '\n')

...at which point one might consider writing their own little, customized shinyCat(...) function, which just wraps the above cat() and automatically sets file = stderr().

That's similar to the solution "Sebastian" proposed on StackOverflow:

if (!interactive()) sink(stderr(), type = "output")

Anyway, resolved.

from shiny.

eddelbuettel avatar eddelbuettel commented on July 18, 2024

It's also simply more of a 'run shiny from the console directly and see logs' versus 'run shiny server as a daemon and scratch your head where logs are' question that has nothing to do with Rocker, per se.

Still a frequent head-scratcher.

from shiny.

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.