You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jerry Malcolm <te...@malcolms.com> on 2020/03/03 16:46:01 UTC

stdout / stderr on AWS Linux

Where are the stdout and stderr log files written for tomcat in AWS 
Linux?  On windows, they are just part of the logs folder. But in AWS 
Linux /var/log/Tomcat I get all of the other log files.  But no 
stdout/stderr.  Most of the info is also in Catalina.out.  But just 
curious where stdout and stderr files have gone.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


catalina.out on AWS Linux 2 (resolved) (was: stdout / stderr on AWS Linux)

Posted by Jerry Malcolm <te...@malcolms.com>.
I finally figured out what is going on.  One point of confusion was that 
the catalina.out processing is different on AWS Linux 1 vs AWS Linux 2.  
In AWS Linux 1, catalina.out exists and is actively being written to.  
When TC is installed on AWS Linux 2, a catalina.out file is created in 
the /var/log/tomcat folder.  But it's an old file with one line that 
says "Tomcat installed...". catalina.out on AWS linux 2 is never touched 
again.  Erase it, and it never comes back.

The reason for all of this is linux's journalctl service that came into 
play in AWS Linux 2.  Apparently, there's no options on whether to use 
this or not.  All 'system level' logs (i.e. catalina.out) get routed to 
journalctl.  The only way to access it is using the journalctl command:  
"#journalctl -u tomcat.service --since today".

The good news is that I finally found the output I've been desperately 
looking for.  The bad news is that I realized I've been getting a bunch 
of exception stack traces in my code that I was not aware of that I now 
have to investigate and fix... :-(

Thanks for the info that got me directed into the right area to figure 
this out.

Jerry

On 3/9/2020 4:58 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Jerry,
>
> On 3/9/20 16:35, Jerry Malcolm wrote:
>> On 3/3/2020 2:45 PM, Christopher Schultz wrote: Jerry,
>>
>> On 3/3/20 11:46, Jerry Malcolm wrote:
>>>>> Where are the stdout and stderr log files written for tomcat
>>>>> in AWS Linux?
>> Are you talking about a Tomcat installed from the package-manager
>> (yum), or one you installed yourself from an ASF distribution?
>>> I installed Tomcat on AWS Linux2 EC2 instance using yum.  I
>>> didn't do any type of customization of the install.  Basically
>>> out-of-the-box TC 8.5 via yum.
>>>>> On windows, they are just part of the logs folder. But in AWS
>>>>> Linux /var/log/Tomcat I get all of the other log files.  But
>>>>> no stdout/stderr.
>> On *NIX systems, this file is usually just called catalina.out
>>
>>>>> Most of the info is also in Catalina.out.
>> That's everything.
>>
>>> Thanks for the info.  But I'm not seeing what you are
>>> describing.
>>> I looked in context.xml for 'swallow output'.  No reference to
>>> 'swallow output' there.
>>> I started looking for catalina.sh per Calder's suggestion.
>>> Apparently this installation doesn't use a catalina.sh. Couldn't
>>> find it anywhere in the EC2 instance.
>>> When I run TC, I get sometimes a catalina.out in the log
>>> directory.  At the same time, I get a catalina.2020.03.09.out.
>>> When they are both there, the dated version is always smaller.
>>> Never really paid much attention to it.  Now for some reason,
>>> catalina.out is not even appearing in the log folder.
>>> catalina.2020.03.09.out contains all of the TC startup stuff in
>>> it.  But it does not have any of my System.out.println(....) or
>>> System.err.println(....) output.
>>> When I was looking for catalina.sh, I found a post on the web
>>> that suggested running: "systemctl status tomcat.service  -l"  I
>>> ran that and got a dump of the java startup command.  But very
>>> strangely, after that, it dumped all of my missing System.out and
>>> System.err println output. Apparently, all of those println
>>> statements were being buffered somewhere.  But I have no clue
>>> what is going on.
> It's systemd hand-wavy magic. Isn't is great?
>
>>> If catalina.out stops disappearing and/or not appearing at all,
>>> hopefully I can find the println output that I need there.  But
>>> if catalina.out continues to not be created, I guess I could run
>>> the systemctl status command to see my output.  But this it
>>> pretty convoluted.
>>> I guess my real question now is what is causing catalina.out to
>>> not be created (I've restarted TC several times).  It used to be
>>> there.  But even when it was there for a while, I would notice it
>>> would disappear kinda like a log-rotation thing.  This may be
>>> some sort of linux activity.  But I still need guidance on what
>>> is going wrong.  I need a reliable way to see my System.out and
>>> System.err output. (I have another tomcat installation on a
>>> separate EC2... It has a catalina.out with all of System.out and
>>> System.err output.  It also has a catalina.2020.03.09.out that
>>> doesn't have my own println output.
>>> How do I get catalina.out to be written?
> Tomcat doesn't ship with a systemd control file, so this is likely to
> be either a RedHat- or Amazon-sourced control file. Coty lurks here,
> and manages those packages for RedHat. I'm not sure what happens
> downstream. I'm not aware of any Amazon folks who hang out around
> here, but I think you might have to ask them directly.
>
> Not a satisfying answer, I know, but an accurate one.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5mvAsACgkQHPApP6U8
> pFhjdQ/9EklsKbnex9N1xT3MgyoPtI/MotGdCATHTxunSaNvAon36fvXcK1tZL55
> sCJlKoX16ZN4cqCxfdAbf/0OUdprfimCwN+4OsDFjNSblo75wJgspvVsyGCc2P3T
> lGYv8+FmogZa4zlZgRFaSjolDehRxIITo2GGnnJZWyVbz4kGOCd+jBJ2gS2PppcC
> mvGUhWNopsXn0aK9ni7fFp9CtTdKMsdL3Hlry8cAg8Vcs1/pF4ky0vqiOBAOikXU
> ofZuvNVE3ClvsdNWfL9saE6KGRWV8Z6RSchQvYqaf4nvyowNfMG7bMig0YpE4ivR
> 8ja0yoh0OP3KsA0gD5FB+3s4MnZK/IozVADji2dPQzO8Uhyh7TeU7ZeKwmp2bdco
> wYI7lsutR/5FbxlBygtIaERPNRVBUn4taxpbrPuT/zlVdH0wb5C+nLQS1b4Lai3d
> 3dF6rlWMt6f2SQLcjti1Kp9HbCKSCCoG8eKPMvfIuCpCihHVMNolpKrV4yS+2qgM
> 9U9btK3PVlwmkhNzeuwRshMb2OiwmhV8K1JjduKMRYOTRlBdZ5D+VGOdCYVtxovF
> 5ioAp7Ufr12WwXsThgMqT2Qd1qlPBHBFKEpt+JhURQyJFa0jg24XwEVcEyx9fCaP
> w0ENwygbMyKu2PXw8iATjXYH1Ep+VfJwIv6TF47CEVY2uL8pG4I=
> =StYv
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: stdout / stderr on AWS Linux

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jerry,

On 3/9/20 16:35, Jerry Malcolm wrote:
> On 3/3/2020 2:45 PM, Christopher Schultz wrote: Jerry,
>
> On 3/3/20 11:46, Jerry Malcolm wrote:
>>>> Where are the stdout and stderr log files written for tomcat
>>>> in AWS Linux?
> Are you talking about a Tomcat installed from the package-manager
> (yum), or one you installed yourself from an ASF distribution?
>> I installed Tomcat on AWS Linux2 EC2 instance using yum.  I
>> didn't do any type of customization of the install.  Basically
>> out-of-the-box TC 8.5 via yum.
>
>>>> On windows, they are just part of the logs folder. But in AWS
>>>> Linux /var/log/Tomcat I get all of the other log files.  But
>>>> no stdout/stderr.
> On *NIX systems, this file is usually just called catalina.out
>
>>>> Most of the info is also in Catalina.out.
> That's everything.
>
>> Thanks for the info.  But I'm not seeing what you are
>> describing.
>
>> I looked in context.xml for 'swallow output'.  No reference to
>> 'swallow output' there.
>
>> I started looking for catalina.sh per Calder's suggestion.
>> Apparently this installation doesn't use a catalina.sh. Couldn't
>> find it anywhere in the EC2 instance.
>
>> When I run TC, I get sometimes a catalina.out in the log
>> directory.  At the same time, I get a catalina.2020.03.09.out.
>> When they are both there, the dated version is always smaller.
>> Never really paid much attention to it.  Now for some reason,
>> catalina.out is not even appearing in the log folder.
>> catalina.2020.03.09.out contains all of the TC startup stuff in
>> it.  But it does not have any of my System.out.println(....) or
>> System.err.println(....) output.
>
>> When I was looking for catalina.sh, I found a post on the web
>> that suggested running: "systemctl status tomcat.service  -l"  I
>> ran that and got a dump of the java startup command.  But very
>> strangely, after that, it dumped all of my missing System.out and
>> System.err println output. Apparently, all of those println
>> statements were being buffered somewhere.  But I have no clue
>> what is going on.

It's systemd hand-wavy magic. Isn't is great?

>> If catalina.out stops disappearing and/or not appearing at all,
>> hopefully I can find the println output that I need there.  But
>> if catalina.out continues to not be created, I guess I could run
>> the systemctl status command to see my output.  But this it
>> pretty convoluted.
>
>> I guess my real question now is what is causing catalina.out to
>> not be created (I've restarted TC several times).  It used to be
>> there.  But even when it was there for a while, I would notice it
>> would disappear kinda like a log-rotation thing.  This may be
>> some sort of linux activity.  But I still need guidance on what
>> is going wrong.  I need a reliable way to see my System.out and
>> System.err output. (I have another tomcat installation on a
>> separate EC2... It has a catalina.out with all of System.out and
>> System.err output.  It also has a catalina.2020.03.09.out that
>> doesn't have my own println output.
>
>> How do I get catalina.out to be written?

Tomcat doesn't ship with a systemd control file, so this is likely to
be either a RedHat- or Amazon-sourced control file. Coty lurks here,
and manages those packages for RedHat. I'm not sure what happens
downstream. I'm not aware of any Amazon folks who hang out around
here, but I think you might have to ask them directly.

Not a satisfying answer, I know, but an accurate one.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5mvAsACgkQHPApP6U8
pFhjdQ/9EklsKbnex9N1xT3MgyoPtI/MotGdCATHTxunSaNvAon36fvXcK1tZL55
sCJlKoX16ZN4cqCxfdAbf/0OUdprfimCwN+4OsDFjNSblo75wJgspvVsyGCc2P3T
lGYv8+FmogZa4zlZgRFaSjolDehRxIITo2GGnnJZWyVbz4kGOCd+jBJ2gS2PppcC
mvGUhWNopsXn0aK9ni7fFp9CtTdKMsdL3Hlry8cAg8Vcs1/pF4ky0vqiOBAOikXU
ofZuvNVE3ClvsdNWfL9saE6KGRWV8Z6RSchQvYqaf4nvyowNfMG7bMig0YpE4ivR
8ja0yoh0OP3KsA0gD5FB+3s4MnZK/IozVADji2dPQzO8Uhyh7TeU7ZeKwmp2bdco
wYI7lsutR/5FbxlBygtIaERPNRVBUn4taxpbrPuT/zlVdH0wb5C+nLQS1b4Lai3d
3dF6rlWMt6f2SQLcjti1Kp9HbCKSCCoG8eKPMvfIuCpCihHVMNolpKrV4yS+2qgM
9U9btK3PVlwmkhNzeuwRshMb2OiwmhV8K1JjduKMRYOTRlBdZ5D+VGOdCYVtxovF
5ioAp7Ufr12WwXsThgMqT2Qd1qlPBHBFKEpt+JhURQyJFa0jg24XwEVcEyx9fCaP
w0ENwygbMyKu2PXw8iATjXYH1Ep+VfJwIv6TF47CEVY2uL8pG4I=
=StYv
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: stdout / stderr on AWS Linux

Posted by Jerry Malcolm <te...@malcolms.com>.
On 3/3/2020 2:45 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Jerry,
>
> On 3/3/20 11:46, Jerry Malcolm wrote:
>> Where are the stdout and stderr log files written for tomcat in
>> AWS Linux?
> Are you talking about a Tomcat installed from the package-manager
> (yum), or one you installed yourself from an ASF distribution?
I installed Tomcat on AWS Linux2 EC2 instance using yum.  I didn't do 
any type of customization of the install.  Basically out-of-the-box TC 
8.5 via yum.
>
>> On windows, they are just part of the logs folder. But in AWS Linux
>> /var/log/Tomcat I get all of the other log files.  But no
>> stdout/stderr.
> On *NIX systems, this file is usually just called catalina.out
>
>> Most of the info is also in Catalina.out.
> That's everything.

Thanks for the info.  But I'm not seeing what you are describing.

I looked in context.xml for 'swallow output'.  No reference to 'swallow 
output' there.

I started looking for catalina.sh per Calder's suggestion. Apparently 
this installation doesn't use a catalina.sh. Couldn't find it anywhere 
in the EC2 instance.

When I run TC, I get sometimes a catalina.out in the log directory.  At 
the same time, I get a catalina.2020.03.09.out. When they are both 
there, the dated version is always smaller. Never really paid much 
attention to it.  Now for some reason, catalina.out is not even 
appearing in the log folder. catalina.2020.03.09.out contains all of the 
TC startup stuff in it.  But it does not have any of my 
System.out.println(....) or System.err.println(....) output.

When I was looking for catalina.sh, I found a post on the web that 
suggested running: "systemctl status tomcat.service  -l"  I ran that and 
got a dump of the java startup command.  But very strangely, after that, 
it dumped all of my missing System.out and System.err println output.  
Apparently, all of those println statements were being buffered 
somewhere.  But I have no clue what is going on.

If catalina.out stops disappearing and/or not appearing at all, 
hopefully I can find the println output that I need there.  But if 
catalina.out continues to not be created, I guess I could run the 
systemctl status command to see my output.  But this it pretty convoluted.

I guess my real question now is what is causing catalina.out to not be 
created (I've restarted TC several times).  It used to be there.  But 
even when it was there for a while, I would notice it would disappear 
kinda like a log-rotation thing.  This may be some sort of linux 
activity.  But I still need guidance on what is going wrong.  I need a 
reliable way to see my System.out and System.err output. (I have another 
tomcat installation on a separate EC2... It has a catalina.out with all 
of System.out and System.err output.  It also has a 
catalina.2020.03.09.out that doesn't have my own println output.

How do I get catalina.out to be written?

Thanks.

Jerry

>
>> But just curious where stdout and stderr files have gone.
> Away, because they really don't need to exist.
>
> If you want them back, you can run jsvc and get separate streams.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5ewfAACgkQHPApP6U8
> pFg+9Q//Zo0XB/QQF9//0F8DQtc86dBKrpkexM9LDvnyVRXluSQOze104oR2wiBs
> jqHCwgwmXvvH4y7Q8lxCtUXlTFGqxcr6otZLjKUztlkb++gMYRtuj974WasTIJbI
> 4DPOJiuRQMQ4AlTQMXQB0sAbdjDzOiYP0Q1RjFRBgWoMS5JXgtv2SJFnHhonV8M8
> /UfBwYUS0NoIYiPPshgPdu/LXVVZwyrjLOiV/4ngTtTMyBFvzI3zN7HwAdVEuMf5
> JUz5fcvI7qR2sgAleRWn1cyYRNdsz37IqwMri363FZitCHRvCfp0h3hJBSukcbny
> a53001IPrN/kU7exIrhO3TM5FvJExj+OsDXgeX6sOvS5roWKsnrXRqgbQxY3I65v
> lcS+2al8nBn0wpv3kkTJ1wDNW+jTnN4GxA1WvGrXRPmbZG1+mmPl9iOr207MDWCO
> GYr3sVe4EHxV8hFhR9AfcIJ5A7IjhcdkIlOhPAxdctUFWUS1KvHcX/Cb8cS6vPRe
> 79v/HlBw2QYB2M3N/8GgYFaKT44E0feQKRDTxmJogreVRyIcDUTkM8W2JN43Hmrb
> Hdlr2h9b2enOhhCDnWJAjIIvXU70hHmmvJz3gyZduuKFrh2l9yau6ktp6wi6CgmG
> 6SoVSiWh0tEKskbYNNFElPkEKc/uxFu+qPnP3GwYlgieCjnDjNE=
> =dukw
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

Re: stdout / stderr on AWS Linux

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jerry,

On 3/3/20 11:46, Jerry Malcolm wrote:
> Where are the stdout and stderr log files written for tomcat in
> AWS Linux?

Are you talking about a Tomcat installed from the package-manager
(yum), or one you installed yourself from an ASF distribution?

> On windows, they are just part of the logs folder. But in AWS Linux
> /var/log/Tomcat I get all of the other log files.  But no
> stdout/stderr.

On *NIX systems, this file is usually just called catalina.out

> Most of the info is also in Catalina.out.

That's everything.

> But just curious where stdout and stderr files have gone.

Away, because they really don't need to exist.

If you want them back, you can run jsvc and get separate streams.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5ewfAACgkQHPApP6U8
pFg+9Q//Zo0XB/QQF9//0F8DQtc86dBKrpkexM9LDvnyVRXluSQOze104oR2wiBs
jqHCwgwmXvvH4y7Q8lxCtUXlTFGqxcr6otZLjKUztlkb++gMYRtuj974WasTIJbI
4DPOJiuRQMQ4AlTQMXQB0sAbdjDzOiYP0Q1RjFRBgWoMS5JXgtv2SJFnHhonV8M8
/UfBwYUS0NoIYiPPshgPdu/LXVVZwyrjLOiV/4ngTtTMyBFvzI3zN7HwAdVEuMf5
JUz5fcvI7qR2sgAleRWn1cyYRNdsz37IqwMri363FZitCHRvCfp0h3hJBSukcbny
a53001IPrN/kU7exIrhO3TM5FvJExj+OsDXgeX6sOvS5roWKsnrXRqgbQxY3I65v
lcS+2al8nBn0wpv3kkTJ1wDNW+jTnN4GxA1WvGrXRPmbZG1+mmPl9iOr207MDWCO
GYr3sVe4EHxV8hFhR9AfcIJ5A7IjhcdkIlOhPAxdctUFWUS1KvHcX/Cb8cS6vPRe
79v/HlBw2QYB2M3N/8GgYFaKT44E0feQKRDTxmJogreVRyIcDUTkM8W2JN43Hmrb
Hdlr2h9b2enOhhCDnWJAjIIvXU70hHmmvJz3gyZduuKFrh2l9yau6ktp6wi6CgmG
6SoVSiWh0tEKskbYNNFElPkEKc/uxFu+qPnP3GwYlgieCjnDjNE=
=dukw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: stdout / stderr on AWS Linux

Posted by calder <ca...@gmail.com>.
On Tue, Mar 3, 2020 at 11:59 AM calder <ca...@gmail.com> wrote:
>
> On Tue, Mar 3, 2020, 10:46 Jerry Malcolm <te...@malcolms.com> wrote:
>>
>> Where are the stdout and stderr log files written for tomcat in AWS
>> Linux?  On windows, they are just part of the logs folder. But in AWS
>> Linux /var/log/Tomcat I get all of the other log files.  But no
>> stdout/stderr.  Most of the info is also in Catalina.out.  But just
>> curious where stdout and stderr files have gone.
>
>
> Check if the context.xml has this config set
>
> <Context ..... swallowOutput="true"
>
> that swallows stdout/err.

(sorry hit Send too soon) ....

Also check catalina.sh, for this entry
#   CATALINA_OUT    (Optional) Full path to a file where stdout and stderr
#                   will be redirected.
#                   Default is $CATALINA_BASE/logs/catalina.out

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: stdout / stderr on AWS Linux

Posted by calder <ca...@gmail.com>.
On Tue, Mar 3, 2020, 10:46 Jerry Malcolm <te...@malcolms.com> wrote:

> Where are the stdout and stderr log files written for tomcat in AWS
> Linux?  On windows, they are just part of the logs folder. But in AWS
> Linux /var/log/Tomcat I get all of the other log files.  But no
> stdout/stderr.  Most of the info is also in Catalina.out.  But just
> curious where stdout and stderr files have gone.
>

Check if the context.xml has this config set

<Context ..... swallowOutput="true"

that swallows stdout/err.