[Gambas-user] how to log to stdout/stderr

Fernando Cabral fernandojosecabral at ...626...
Fri Jul 14 02:54:57 CEST 2017


2017-07-13 21:21 GMT-03:00 PICCORO McKAY Lenz <mckaygerhard at ...626...>:

> the nohup trick not always work.. for that there's the gambas redirection
> print.. that's why i ask previously how i detec if are runnig inside ide..
> if are inside ide. let normal print, if not, redirect...
>
> I am not sure I have understood what you said. What I can say is that, for
logging purpose, you can just open a regular file and then write to or
append to.

In order to determine if your application is running as a daemon or not, if
can be quite easy and fool proof. For intance, you can create a command
line options like, say "-d". If it is present, your applicaiton should run
as a daemon, so you act accordingly. Otherwise the application is not
running as daemon, so you should act as a regular application.

As to printing (if you mean, printing to a printer proper) you can either
open a pipe to the printer daemon or else create a file and then use a
shell () instruction to print and delete that file. Both should work well.

- fernando




> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-07-13 19:54 GMT-04:00 Fernando Cabral <fernandojosecabral at ...626...>:
>
> > 2017-07-13 17:11 GMT-03:00 Tobias Boege <taboege at ...626...> said:
> >
> > > As we discussed recently [1], stdout and stderr are redirected to
> > /dev/null
> > > when you daemonise, so there is not really any value in wanting to
> print
> > > there if you want to make a daemon.
> >
> >
> > I don't know if I have understood you correctly and completely.
> >  I am an old timer and Linux may have changed things as compared to UNIX.
> > A daemon is supposed to run in the background. Typically, when you put
> > something to
> > run in the background, Unix would send the standard output to... standard
> > output.
> >
> > Now, if you do "nohup something.gambas", standard outuput will to to
> > "nohup.out".
> > But, if you do "nohup something.gambas >x &" or "something.gambas >x",
> > standard output wll be sent to "x".
> >
> > In any case, if you don't want to preserve any output, you should
> redirect
> > stderr and
> > stdout to /dev/null.
> >
> > I would guess that a daemon started at startup or by cron would give the
> > same result.
> > Am I wrong?
> >
> > Regards
> >
> > - fernando
> >
> > > [1] https://sourceforge.net/p/gambas/mailman/gambas-user/
> > > thread/1498036647346-59450.post%40n7.nabble.com/#msg35904830
> > > [2] https://stackoverflow.com/questions/17954432/creating-a-
> > > daemon-in-linux
> > >
> > > --
> > > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> > >
> > > ------------------------------------------------------------
> > > ------------------
> > > Check out the vibrant tech community on one of the world's most
> > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
> > >
> >
> >
> >
> > --
> > Fernando Cabral
> > Blogue: http://fernandocabral.org
> > Twitter: http://twitter.com/fjcabral
> > e-mail: fernandojosecabral at ...626...
> > Facebook: f at ...3654...
> > Telegram: +55 (37) 99988-8868
> > Wickr ID: fernandocabral
> > WhatsApp: +55 (37) 99988-8868
> > Skype:  fernandojosecabral
> > Telefone fixo: +55 (37) 3521-2183
> > Telefone celular: +55 (37) 99988-8868
> >
> > Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> > nenhum político ou cientista poderá se gabar de nada.
> > ------------------------------------------------------------
> > ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecabral at ...626...
Facebook: f at ...3654...
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype:  fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868

Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.



More information about the User mailing list