Puppet Class: tomcat::logging

Defined in:
manifests/logging.pp

Overview

Class: tomcat::logging

Links logging libraries in tomcat installation directory

This class must not be included directly. It is automatically included by the tomcat module.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'manifests/logging.pp', line 8

class tomcat::logging {

  $conffile = "puppet:///modules/${module_name}/conf/log4j.rolling.properties"

  $base_path = $::tomcat::version ? {
    '5'     => "${::tomcat::home}/common/lib",
    default => "${::tomcat::home}/lib",
  }

  $log4j_packages = $::osfamily? {
    'Debian' => ['liblog4j1.2-java', 'libcommons-logging-java'],
    'RedHat' => ['log4j', $::tomcat::params::commons_logging_package],
  }

  package {$log4j_packages:
    ensure => present,
  }

  $log4j = $::osfamily? {
    'Debian' => '/usr/share/java/log4j-1.2.jar',
    'RedHat' => '/usr/share/java/log4j.jar',
  }

  # The source class need (and define) this directory before logging
  if $::tomcat::sources == false {
    file {$base_path:
      ensure => directory,
    }
  }

  file {'/var/log/tomcat':
    ensure => directory,
    owner  => 'tomcat',
    group  => 'tomcat',
  }

  file {'commons-logging.jar':
    ensure  => link,
    path    => "${base_path}/commons-logging.jar",
    target  => '/usr/share/java/commons-logging.jar',
    require => Package[$log4j_packages],
  }

  file {'log4j.jar':
    ensure  => link,
    path    => "${base_path}/log4j.jar",
    target  => $log4j,
    require => Package[$log4j_packages],
  }

  file {'log4j.properties':
    path    => "${base_path}/log4j.properties",
    source  => $conffile,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => Package[$log4j_packages],
  }

}