Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-25 Thread Lennart Poettering
On Mon, 18.08.14 15:50, Reindl Harald (h.rei...@thelounge.net) wrote:

 
 
 Am 18.08.2014 um 15:27 schrieb Lennart Poettering:
  And also I would like to see the full logs always by default.
  Usually after lots of searching you find the offending log entry for
  the error, only to find out you forgot to pass the right command
  line options to journalctl and the important bit is cut off.
  
  cut off? You can just scroll to the right in most pagers, such as less?
 
 that don't change the fact --full should be the default instead force
 anybody with a smaller screen to create aliases if he want to read
 things just by use the scrollbar modern terminal applications like
 konsole offer

--full has been the default since quite some time.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-24 Thread Reindl Harald


Am 18.08.2014 um 15:27 schrieb Lennart Poettering:
 And also I would like to see the full logs always by default.
 Usually after lots of searching you find the offending log entry for
 the error, only to find out you forgot to pass the right command
 line options to journalctl and the important bit is cut off.
 
 cut off? You can just scroll to the right in most pagers, such as less?

that don't change the fact --full should be the default instead force
anybody with a smaller screen to create aliases if he want to read
things just by use the scrollbar modern terminal applications like
konsole offer



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Philippe De Swert

Hi,

Having to often use journalctl it has slowly driven me insane with the 
default options not matching common use cases.


Attached is already a patch to start the journal at the end. Usually 
people check the logs when something went wrong, and don't care about 
what happened three weeks ago at the beginning of the log. Yes you can 
press the end key to skip to the end but in some cases that freezes up 
the console for over a minute.


Other gripes are --no-pager... way too long to type on a virtual 
keyboard when you are trying to use the logs old style with common unix
utilities. Maybe not having it by default, or introducing a shorter 
command switch should not be hard to add.


And also I would like to see the full logs always by default. Usually 
after lots of searching you find the offending log entry for the error, 
only to find out you forgot to pass the right command line options to 
journalctl and the important bit is cut off.


If you guys are willing to also consider those other two gripes I will 
glady submit patches for those also.


Regards,

Philippe
From b4c8bd945bc987edd64702e781daea2caff8eeab Mon Sep 17 00:00:00 2001
From: Philippe De Swert philippe.desw...@jollamobile.com
Date: Mon, 18 Aug 2014 14:39:19 +0300
Subject: [PATCH] journalctl : automatically go to the end of the log

Usually we do not care about the beginning of the log, as we want to look
at it when something went wrong. So usually this would be the end. So changing
the end feature into a start feature will cause less typing. (Also jumping to
the end of a log with the end key sometimes takes a considerable amount of time,
so we avoid that issue here too). To restore the old behaviour to start at the
beginning of the log, there is now -s or --pager-start. -e is kept for backwards
compatability.

Signed-off-by: Philippe De Swert philippe.desw...@jollamobile.com
---
 src/journal/journalctl.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5c4a71d..67f3a26 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -63,7 +63,7 @@
 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
 
 static OutputMode arg_output = OUTPUT_SHORT;
-static bool arg_pager_end = false;
+static bool arg_pager_end = true;
 static bool arg_follow = false;
 static bool arg_full = true;
 static bool arg_all = false;
@@ -182,6 +182,7 @@ static void help(void) {
 --user-unit=UNIT  Show data only from the specified user session unit\n
  -p --priority=RANGE  Show only messages within the specified priority range\n
  -e --pager-end   Immediately jump to end of the journal in the pager\n
+ -s --pager-start Start at the beginning of the journal in the pager\n
  -f --follow  Follow the journal\n
  -n --lines[=INTEGER] Number of journal entries to show\n
 --no-tail Show all lines, even in follow mode\n
@@ -255,6 +256,7 @@ static int parse_argv(int argc, char *argv[]) {
 { version ,   no_argument,   NULL, ARG_VERSION},
 { no-pager,   no_argument,   NULL, ARG_NO_PAGER   },
 { pager-end,  no_argument,   NULL, 'e'},
+{ pager-start,no_argument,   NULL, 's'},
 { follow, no_argument,   NULL, 'f'},
 { force,  no_argument,   NULL, ARG_FORCE  },
 { output, required_argument, NULL, 'o'},
@@ -304,7 +306,7 @@ static int parse_argv(int argc, char *argv[]) {
 assert(argc = 0);
 assert(argv);
 
-while ((c = getopt_long(argc, argv, hefo:aln::qmb::kD:p:c:u:F:xrM:, options, NULL)) = 0)
+while ((c = getopt_long(argc, argv, hesfo:aln::qmb::kD:p:c:u:F:xrM:, options, NULL)) = 0)
 
 switch (c) {
 
@@ -329,6 +331,15 @@ static int parse_argv(int argc, char *argv[]) {
 
 break;
 
+case 's':
+arg_pager_end = false;
+
+if (arg_lines  0)
+arg_lines = 1000;
+
+break;
+
+
 case 'f':
 arg_follow = true;
 break;
-- 
1.8.1.2

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Ronny Chevalier
2014-08-18 13:46 GMT+02:00 Philippe De Swert philippedesw...@gmail.com:
 Hi,
Hi,


 Having to often use journalctl it has slowly driven me insane with the
 default options not matching common use cases.

 Attached is already a patch to start the journal at the end. Usually people
 check the logs when something went wrong, and don't care about what happened
 three weeks ago at the beginning of the log. Yes you can press the end key
 to skip to the end but in some cases that freezes up the console for over a
 minute.
There is the --reverse or -r option to show the newest entries first,
is this what you are looking for ?


 Other gripes are --no-pager... way too long to type on a virtual keyboard
 when you are trying to use the logs old style with common unix
 utilities. Maybe not having it by default, or introducing a shorter command
 switch should not be hard to add.

 And also I would like to see the full logs always by default. Usually after
 lots of searching you find the offending log entry for the error, only to
 find out you forgot to pass the right command line options to journalctl and
 the important bit is cut off.
There is the --all or -a option for this.

In the end, you just have to use journalctl -ar


 If you guys are willing to also consider those other two gripes I will glady
 submit patches for those also.

 Regards,

 Philippe

 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Philippe De Swert
Hi,

Seems the patch has been scrubbed. Will re-send it later if there is interest 
to have it. Should have used git send-email I guess, but now badly inlined at 
the bottom of this email.

Thank you for your help, but you seem to have misunderstood what I am after.

On 18/08/14 15:08, Ronny Chevalier wrote:
 2014-08-18 13:46 GMT+02:00 Philippe De Swert philippedesw...@gmail.com:
 Having to often use journalctl it has slowly driven me insane with the
 default options not matching common use cases.

 Attached is already a patch to start the journal at the end. Usually people
 check the logs when something went wrong, and don't care about what happened
 three weeks ago at the beginning of the log. Yes you can press the end key
 to skip to the end but in some cases that freezes up the console for over a
 minute.
 There is the --reverse or -r option to show the newest entries first,
 is this what you are looking for ?

No. I want -e as default option, as that is what makes sense to me. And I keep 
hearing the same from lots of people that -e should be default. 

 Other gripes are --no-pager... way too long to type on a virtual keyboard
 when you are trying to use the logs old style with common unix
 utilities. Maybe not having it by default, or introducing a shorter command
 switch should not be hard to add.

 And also I would like to see the full logs always by default. Usually after
 lots of searching you find the offending log entry for the error, only to
 find out you forgot to pass the right command line options to journalctl and
 the important bit is cut off.
 There is the --all or -a option for this.

 In the end, you just have to use journalctl -ar

The point is that I think that -a should be default. I can't think of any 
reason 
to have truncated and mangled logs by default. As it too often happens that you 
forget to add the flag as I just explained, you end up to have do all the 
searching again due to the interesting bit of the log being cut/truncated.

The issue is having to use all those switches. Mainly I get sick of having to 
type 
journalctl --no-pager -a -e on a virtual keyboard every time on a development 
platform that gets reflashed continuously so having aliases etc is not really a 
workable option. And well and the pager I do sometimes want it and other times 
I 
don't. Depends on what I want to do.

As I stated I am willing to send patches to fix journalctl default behaviour to 
match 
common use cases. I know about the switches. My point is that you should not 
need to 
remember every time to use some switches to get default usable behaviour from 
journalctl 
when performing a simple basic operation.

Regards,

Philippe

From b4c8bd945bc987edd64702e781daea2caff8eeab Mon Sep 17 00:00:00 2001
From: Philippe De Swert philippedesw...@gmail.com
Date: Mon, 18 Aug 2014 14:39:19 +0300
Subject: [PATCH] journalctl : automatically go to the end of the log

Usually we do not care about the beginning of the log, as we want to look
at it when something went wrong. So usually this would be the end. So changing
the end feature into a start feature will cause less typing. (Also jumping to
the end of a log with the end key sometimes takes a considerable amount of time,
so we avoid that issue here too). To restore the old behaviour to start at the
beginning of the log, there is now -s or --pager-start. -e is kept for backwards
compatibility.

Signed-off-by: Philippe De Swert philippedesw...@gmail.com
---
 src/journal/journalctl.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5c4a71d..67f3a26 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -63,7 +63,7 @@
 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)

 static OutputMode arg_output = OUTPUT_SHORT;
-static bool arg_pager_end = false;
+static bool arg_pager_end = true;
 static bool arg_follow = false;
 static bool arg_full = true;
 static bool arg_all = false;
@@ -182,6 +182,7 @@ static void help(void) {
 --user-unit=UNIT  Show data only from the specified 
user session unit\n
  -p --priority=RANGE  Show only messages within the 
specified priority range\n
  -e --pager-end   Immediately jump to end of the 
journal in the pager\n
+ -s --pager-start Start at the beginning of the 
journal in the pager\n
  -f --follow  Follow the journal\n
  -n --lines[=INTEGER] Number of journal entries to show\n
 --no-tail Show all lines, even in follow 
mode\n
@@ -255,6 +256,7 @@ static int parse_argv(int argc, char *argv[]) {
 { version ,   no_argument,   NULL, ARG_VERSION   
 },
 { no-pager,   no_argument,   NULL, ARG_NO_PAGER  
 },
 { pager-end,  no_argument,   NULL, 'e'   
 },
+ 

Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Lennart Poettering
On Mon, 18.08.14 14:46, Philippe De Swert (philippedesw...@gmail.com) wrote:

 Hi,
 
 Having to often use journalctl it has slowly driven me insane with
 the default options not matching common use cases.
 
 Attached is already a patch to start the journal at the end. Usually
 people check the logs when something went wrong, and don't care
 about what happened three weeks ago at the beginning of the log. Yes
 you can press the end key to skip to the end but in some cases
 that freezes up the console for over a minute.

Well, its more complex than that. I know that a lot of people do
journalctl -b more often than journalctl -e. I really don#t want to
be in the business of saying that -e is the way to go and -b is
not. I am pretty sure we should choose defaults that are obvious, and I
figure showing all the logs is the most obvious thing to do, if you
don't specify anything.

Moreover, journalctl is frequently now used in scripts, we cannot change
the defaults really now, that would break all scripts. journalctl is API now.

I'd recommend to simple set a shell alias to map journalctl to
journalctl -e if that's what you prefer. That way you maintain API
compatibility while simplifying what you have to type the way you
prefer. (Actually, you could even map j to journalctl -e, making
things even easier to type).

 Other gripes are --no-pager... way too long to type on a virtual
 keyboard when you are trying to use the logs old style with common
 unix utilities. Maybe not having it by default, or introducing a
 shorter command switch should not be hard to add.

Hmm? Note that the pager is turned off automatzically if you use
journalctl in a pipe. --no-pager is nothing you ever should need to
type manually...

 And also I would like to see the full logs always by default.
 Usually after lots of searching you find the offending log entry for
 the error, only to find out you forgot to pass the right command
 line options to journalctl and the important bit is cut off.

cut off? You can just scroll to the right in most pagers, such as less?

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Lennart Poettering
On Mon, 18.08.14 16:02, Philippe De Swert (philippedesw...@gmail.com) wrote:

 The point is that I think that -a should be default. I can't think of any 
 reason 
 to have truncated and mangled logs by default. As it too often happens that 
 you 
 forget to add the flag as I just explained, you end up to have do all the 
 searching again due to the interesting bit of the log being
 cut/truncated.

SInce a longer time lines are not truncated anymore, unless your pager
does it. But less doesn't, you can just scroll to the right... And if
you disable the pager, we won't either...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Philippe De Swert
Hi,

Thanks for answering.

On 18/08/14 16:27, Lennart Poettering wrote:
 On Mon, 18.08.14 14:46, Philippe De Swert (philippedesw...@gmail.com) wrote:
 Well, its more complex than that. I know that a lot of people do
 journalctl -b more often than journalctl -e. I really don#t want to
 be in the business of saying that -e is the way to go and -b is
 not. I am pretty sure we should choose defaults that are obvious, and I
 figure showing all the logs is the most obvious thing to do, if you
 don't specify anything.
 Moreover, journalctl is frequently now used in scripts, we cannot change
 the defaults really now, that would break all scripts. journalctl is API now.

I could argue that most people who use -b might not know about -e, or
that scripts would not use default journalctl behaviour. (I actually
included a -s option in the patch to have journalctl with the old
behaviour) But this will only degrade in a personal preferences game I
guess.

 I'd recommend to simple set a shell alias to map journalctl to
 journalctl -e if that's what you prefer. That way you maintain API
 compatibility while simplifying what you have to type the way you
 prefer. (Actually, you could even map j to journalctl -e, making
 things even easier to type).

I did explain I knew what aliases were and why they would not work.
Constantly changing environment, needing to make sure something does not
magically work on one device due to aliases and not on another etc...

 Other gripes are --no-pager... way too long to type on a virtual
 keyboard when you are trying to use the logs old style with common
 unix utilities. Maybe not having it by default, or introducing a
 shorter command switch should not be hard to add.
 
 Hmm? Note that the pager is turned off automatzically if you use
 journalctl in a pipe. --no-pager is nothing you ever should need to
 type manually...

Had not noticed that. Got used to hurt my fingers and typing --no-pager
the whole time. Good to know, thanks.

 And also I would like to see the full logs always by default.
 Usually after lots of searching you find the offending log entry for
 the error, only to find out you forgot to pass the right command
 line options to journalctl and the important bit is cut off.
 
 cut off? You can just scroll to the right in most pagers, such as less?

Good luck doing that when you don't have arrow keys available. Moreover
I still believe wrapping would be more useful. But personal preferences
again I guess.

So I guess I will just maintain the patches for our internal use then,
if we chose to do so at the cost of diverging from upstream. At least
the people here like the behaviour I proposed. If anybody else wants the
patches I will gladly provide them.

Regards,

Philippe

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Lennart Poettering
On Mon, 18.08.14 17:19, Philippe De Swert (philippedesw...@gmail.com) wrote:

  Moreover, journalctl is frequently now used in scripts, we cannot change
  the defaults really now, that would break all scripts. journalctl is API 
  now.
 
 I could argue that most people who use -b might not know about -e, or
 that scripts would not use default journalctl behaviour. (I actually
 included a -s option in the patch to have journalctl with the old
 behaviour) But this will only degrade in a personal preferences game I
 guess.
 
  I'd recommend to simple set a shell alias to map journalctl to
  journalctl -e if that's what you prefer. That way you maintain API
  compatibility while simplifying what you have to type the way you
  prefer. (Actually, you could even map j to journalctl -e, making
  things even easier to type).
 
 I did explain I knew what aliases were and why they would not work.
 Constantly changing environment, needing to make sure something does not
 magically work on one device due to aliases and not on another etc...

I think it might make sense to maybe file bugs against a number of
distros, asking them to maybe set the alias by default, the way many
distros set shorter aliases by default for some ls invocations.

We could maybe even ship something like that in systemd upstream, but
afaik there's no standard place we could hook that into bash. 

alias jb='journalctl -b'
alias je='journalctl -e'

Doesn't sound too terrible for me to have as suggested default
aliases...

  And also I would like to see the full logs always by default.
  Usually after lots of searching you find the offending log entry for
  the error, only to find out you forgot to pass the right command
  line options to journalctl and the important bit is cut off.
  
  cut off? You can just scroll to the right in most pagers, such as less?
 
 Good luck doing that when you don't have arrow keys available. Moreover
 I still believe wrapping would be more useful. But personal preferences
 again I guess.

I am pretty sure doing the auto-paging thing (the same way as git, and
others do it) improves end-user experience for most people. I mean, I
think having arrow keys is the common case. Not having them is the rare
exception...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Aug 18, 2014 at 04:42:52PM +0200, Lennart Poettering wrote:
 On Mon, 18.08.14 17:19, Philippe De Swert (philippedesw...@gmail.com) wrote:
 
   Moreover, journalctl is frequently now used in scripts, we cannot change
   the defaults really now, that would break all scripts. journalctl is API 
   now.
  
  I could argue that most people who use -b might not know about -e, or
  that scripts would not use default journalctl behaviour. (I actually
  included a -s option in the patch to have journalctl with the old
  behaviour) But this will only degrade in a personal preferences game I
  guess.
  
   I'd recommend to simple set a shell alias to map journalctl to
   journalctl -e if that's what you prefer. That way you maintain API
   compatibility while simplifying what you have to type the way you
   prefer. (Actually, you could even map j to journalctl -e, making
   things even easier to type).
  
  I did explain I knew what aliases were and why they would not work.
  Constantly changing environment, needing to make sure something does not
  magically work on one device due to aliases and not on another etc...
 
 I think it might make sense to maybe file bugs against a number of
 distros, asking them to maybe set the alias by default, the way many
 distros set shorter aliases by default for some ls invocations.
 
 We could maybe even ship something like that in systemd upstream, but
 afaik there's no standard place we could hook that into bash. 
 
 alias jb='journalctl -b'
 alias je='journalctl -e'
 
 Doesn't sound too terrible for me to have as suggested default
 aliases...
Many shells use 'j' for and similar things for jobs, autojump uses 'j'
to change directories... I don't think we should try to enter into the
crowded world of short shell aliases.

Also, it seems that there aren't any other commands starting with 'jou',
so 'jouTAB' should be enough.

   And also I would like to see the full logs always by default.
   Usually after lots of searching you find the offending log entry for
   the error, only to find out you forgot to pass the right command
   line options to journalctl and the important bit is cut off.
   
   cut off? You can just scroll to the right in most pagers, such as less?
  
  Good luck doing that when you don't have arrow keys available. Moreover
  I still believe wrapping would be more useful. But personal preferences
  again I guess.
 
 I am pretty sure doing the auto-paging thing (the same way as git, and
 others do it) improves end-user experience for most people. I mean, I
 think having arrow keys is the common case. Not having them is the rare
 exception...
You can say -Senter in less to instruct it to wrap lines.

For me, the only conclusion from this thread is that we should expand
the EXAMPLES chapter in journalctl(1) to deal more with pipes and common
usage.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Andrei Borzenkov
В Mon, 18 Aug 2014 16:42:52 +0200
Lennart Poettering lenn...@poettering.net пишет:

 
 I am pretty sure doing the auto-paging thing (the same way as git, and
 others do it) improves end-user experience for most people. I mean, I
 think having arrow keys is the common case. Not having them is the rare
 exception...
 

It's not only whether keys are available but also terminal size.
Personally I find default (lack of) line wrapping quite annoying - I'm
still have to use small notebook with relatively tiny terminal size and
default behavior means permanent scrolling right and left to see
message itself and its timestamp (or origin) etc.

I think line wrapping by default is really more user friendly - with
small terminal it allows you to use whole message at once and with
large terminal most lines probably fit in the width anyway so there will
be no difference.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Make journalctl start at the end of the journal by default

2014-08-18 Thread Tobias Geerinckx-Rice
On 18 August 2014 17:33, Andrei Borzenkov arvidj...@gmail.com wrote:

 Personally I find default (lack of) line wrapping quite annoying [...]
 I think line wrapping by default is really more user friendly.

Agreed. I assume there was a good reason to add -S to the default
pager options, but I can't imagine what it would be. I've a patch
applied locally that removes it, because I'm fussy that way. I'd sent
it, but it's ridiculously trivial

   T G-R

PS: oh hell, I'm staring at it anyway. Here you go. Might save someone
4 seconds of grepping.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel