Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server logging during app initialization produces output only after application hot reload. #547

Open
2 tasks done
kaglowka opened this issue Apr 15, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working

Comments

@kaglowka
Copy link

kaglowka commented Apr 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Logging using empirica/core/console doesn't initially print data in the console. Logs are displayed only on hot reload.

I loaded (from a file) external additional data used in my experiment and I tried to print some information on it in the console, so I see what data the current Empirica server uses.

I don't know what's the reason. As you can see below I tried to log both in the main thread as well as within a new thread.
I imagine any of these two solutions would be more than fine:

  • change the behaviour so the code above produces output immediately
  • add a special callback run on full server initialization (such as Meteor.startup() in Empirica 1 where such logging or any time-consuming operations could be done after Empirica core server is already responsive & running.

Steps To Reproduce

  1. create new experiment project
  2. add in index.js or callbacks.js
import { info, error} from "@empirica/core/console";
function printSync() {
    info('output 1')
    error('output 2')
    console.info('output 3')
    console.error('output 4')
}
function printAsync() {
    info('output 5')
    error('output 6')
    console.info('output 7')
    console.error('output 8')
}

printSync();
(async () => printAsync())();

Output

[server] output 4
[server] output 8

   Empirica (build #208) server running:                                                                
                                                                                                        
      Player  http://localhost:3000                                                                     
      Admin   http://localhost:3000/admin                                                               
                                                                                                        

On adding any change to the file and saving:

14:10:10.514 ERR callbacks: exited, retrying error="exit status 1"
[server] building file list ... 
[server] 0 files to consider
[server] 14:10:12.016 INF output 1
[server] 14:10:12.017 ERR output 2
[server] output 3
[server] output 4
[server] 14:10:12.018 INF output 5
[server] 14:10:12.018 ERR output 6
[server] output 7
[server] output 8
[server] 14:10:12.433 INF server: started
server refreshed    

Empirica Version

1.10

What OS are you seeing the problem on?

Linux (Ubuntu 22.04)

What browser are you seeing the problem on?

Does not apply

Relevant log output

No response

Anything else?

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kaglowka kaglowka added the bug Something isn't working label Apr 15, 2024
@npaton
Copy link
Contributor

npaton commented Apr 18, 2024

Startup logs are indeed muted at startup. You should be able to get back startup logs with --log.level debug. I will look into always printing logs at startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants