Before this commit,
log4j logfile name was hardcoded to puppetdb. This broke logrotation
which used @name and so was pe-puppetdb on pe installations.
(maint) Lift variables out of conditionals

These variables (initscriptname, log_dir) are always composed of a string
followed by the @name variable, so it makes little sense to repeat their
definition in each branch of the if @pe conditional. This commit moves them
below the conditional, where @name is defined and they can be safely defined.
(maint) Make the use of @log_dir consistent

Previously, /var/log/@name, @log_dir, and @log_dir || /var/log/puppetdb were
all in use. As @log_dir is always defined when the templates get evaluated,
they don't need a default case to fall back to. This commit makes the use of
@log_dir and @log_dir/@name consistent in the templates.
Merge pull request #683 from haus/ticket/1.5.x/logging_and_more_logging

logging fixes
Log errors when invoking a subcommand

The main dispatcher scans available namespaces and dispatches to the
specified "-main" function. For example, running the "services"
subcommand would trigger loading of the "-main" function in the
"com.puppetlabs.puppetdb.cli.services" namespace.

However, if there was an error during the attempt to "require" that
namespace, it wouldn't be logged properly. This commit adds the
"require" step to the existing try/catch block.
Fix broken require
Merge branch 'namespace-fix' into 1.5.x

* namespace-fix:
  Fix broken require
  Log errors when invoking a subcommand
Validate facts order-by against strings
Validate nodes order-by against strings
Merge pull request #686 from shakedown/bug/1.5.x/paging-order-by-strings

Bug: validate order-by against strings for facts/fact-names/nodes
Merge branch '1.5.x'

* 1.5.x:
  Validate nodes order-by against strings
  Validate facts order-by against strings
  Fix broken require
  Log errors when invoking a subcommand
  (maint) Make the use of @log_dir consistent
  (maint) Lift variables out of conditionals
  Before this commit, log4j logfile name was hardcoded to puppetdb. This broke logrotation which used @name and so was pe-puppetdb on pe installations.