Hi - I've been messing around with deploying a hobby pharo app to the web.. 
which has become a lot simpler over the years, although the tech keeps changing 
and you have to relearn things.

Anyway, I have my image in one of the wonderful BA Docker containers, and it 
runs well - and the host I'm using will show the logs for you, so you can 
figure out what is going on... well that is if your logs come out properly (and 
of course, if it gets really hairy then you can get a VNC session onto the 
image and figure stuff out)

So logs are handy, and pharo these days has a nice headless mode that redirects 
the Transcript to stdout - and there are also a few decent logging frameworks 
as well.

But as most things go to the Transcript, and that goes to stdout - it should be 
good. 

HOWEVER - flushing is the killer, as if things happen and the last thing goes 
wrong, but the output isn't flushed, then you aren't going to see it.

So my question is how to properly flush? And I'm sure I've read something about 
this before, but I can't find it.

>From memory,  you often need to have a Transcript cr.  to flush your last line.

BUT, most things in the image seem to use  "self crTrace:"  these days, which 
is a cr to ensure the previous msg is separated from what you want to write, 
and then you write your line out. However, as there is now cr -  you might not 
see it.

So I tried changing my stuff to use "self traceCr:" (which is in the image), 
and that still didn't seem to work - the last failing line wasn't being output. 
Worse still, its confusing, as many things in the image are using crTrace: and 
so you get intermingled messages, which are hard to decipher.

So I tried: Transcript cr; show: msg; flush

But that didn't seem to work (which I don't understand)

Eventually I did: Transcript show: msg; cr; flush

And this seems to ensure things do reliably get outputted - but I'm wondering 
if anyone can shed light on this areas?

Ideally I want to use: Transcript cr'; show: msg; flush 

As this plays much better with everything that is in the image - but is there 
some way to do this? And indeed, will log tools the Bettersatack or papertail 
play ball with output like this (as I guess they operate on complete lines to 
interpret log levels etc),

Anyway - I'm curious if anyone else has done work in this area to shed light?

Thanks,

Tim


As an aside - for deployment - several years ago I came across dockerize.io - 
which lets you upload a Docker image to a host, and it will run it for you. 
Sadly that service didn't survive... but there are quite a few like it now, and 
so I'm trying Render.com - which is similar, but the twist is you need to store 
a Docker image in a registry somewhere (I use gitlab from my CI pipeline), and 
then it will retrieve it and run it for you (for either free in 40 minute 
chunks, or for $7/m - which is pretty good, and possibly bit simpler than 
Digital Ocean). Its pretty cool, and maybe I will write up about it sometime

Reply via email to