Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

- Merge trunk with branch tman

  • Loading branch information...
commit e36f5e4440c4be7c7164cf1ae4156103ad1c0517 1 parent 0b6319d
caraboides authored

Showing 155 changed files with 24,643 additions and 484 deletions. Show diff stats Hide diff stats

  1. +1 0  AUTHORS
  2. +2 0  Makefile.in
  3. +4 0 bin/boot.sh
  4. +2 2 bin/cs_local.sh
  5. +2 2 bin/cs_local2.sh
  6. +2 2 bin/cs_local3.sh
  7. +29 0 bin/experiments.sh
  8. +29 8 bin/scalaris.cfg
  9. +40 0 contrib/log4erl/CHANGELOG.txt
  10. +470 0 contrib/log4erl/LICENSE.txt
  11. +17 0 contrib/log4erl/Makefile
  12. +256 0 contrib/log4erl/README.txt
  13. +18 0 contrib/log4erl/TODO.txt
  14. +11 0 contrib/log4erl/ebin/log4erl.app
  15. +46 0 contrib/log4erl/include/log4erl.hrl
  16. +1 0  contrib/log4erl/priv/file_logger.conf
  17. +1 0  contrib/log4erl/priv/logger1.conf
  18. +1 0  contrib/log4erl/priv/logger2.conf
  19. +46 0 contrib/log4erl/src/Makefile
  20. +57 0 contrib/log4erl/src/console_appender.erl
  21. +32 0 contrib/log4erl/src/dummy_appender.erl
  22. +160 0 contrib/log4erl/src/file_appender.erl
  23. +219 0 contrib/log4erl/src/log4erl.erl
  24. +74 0 contrib/log4erl/src/log4erl_sup.erl
  25. +122 0 contrib/log4erl/src/log4erl_utils.erl
  26. +217 0 contrib/log4erl/src/log_formatter.erl
  27. +54 0 contrib/log4erl/src/log_manager.erl
  28. +56 0 contrib/log4erl/src/logger_guard.erl
  29. +27 0 contrib/yaws/LICENSE
  30. BIN  contrib/yaws/ebin/authmod_gssapi.beam
  31. BIN  contrib/yaws/ebin/haxe.beam
  32. BIN  contrib/yaws/ebin/json.beam
  33. BIN  contrib/yaws/ebin/jsonrpc.beam
  34. BIN  contrib/yaws/ebin/mime_type_c.beam
  35. BIN  contrib/yaws/ebin/mime_types.beam
  36. +1 1  contrib/yaws/ebin/yaws.app
  37. BIN  contrib/yaws/ebin/yaws.beam
  38. BIN  contrib/yaws/ebin/yaws_404.beam
  39. BIN  contrib/yaws/ebin/yaws_api.beam
  40. BIN  contrib/yaws/ebin/yaws_app.beam
  41. BIN  contrib/yaws/ebin/yaws_appmod_cgi.beam
  42. BIN  contrib/yaws/ebin/yaws_cgi.beam
  43. BIN  contrib/yaws/ebin/yaws_compile.beam
  44. BIN  contrib/yaws/ebin/yaws_config.beam
  45. BIN  contrib/yaws/ebin/yaws_ctl.beam
  46. BIN  contrib/yaws/ebin/yaws_dav.beam
  47. BIN  contrib/yaws/ebin/yaws_debug.beam
  48. BIN  contrib/yaws/ebin/yaws_generated.beam
  49. BIN  contrib/yaws/ebin/yaws_html.beam
  50. BIN  contrib/yaws/ebin/yaws_jsonrpc.beam
  51. BIN  contrib/yaws/ebin/yaws_log.beam
  52. BIN  contrib/yaws/ebin/yaws_log_file_h.beam
  53. BIN  contrib/yaws/ebin/yaws_ls.beam
  54. BIN  contrib/yaws/ebin/yaws_pam.beam
  55. BIN  contrib/yaws/ebin/yaws_revproxy.beam
  56. BIN  contrib/yaws/ebin/yaws_rpc.beam
  57. BIN  contrib/yaws/ebin/yaws_rss.beam
  58. BIN  contrib/yaws/ebin/yaws_sendfile.beam
  59. BIN  contrib/yaws/ebin/yaws_sendfile_compat.beam
  60. BIN  contrib/yaws/ebin/yaws_server.beam
  61. BIN  contrib/yaws/ebin/yaws_session_server.beam
  62. BIN  contrib/yaws/ebin/yaws_soap_lib.beam
  63. BIN  contrib/yaws/ebin/yaws_soap_srv.beam
  64. BIN  contrib/yaws/ebin/yaws_sup.beam
  65. BIN  contrib/yaws/ebin/yaws_sup_restarts.beam
  66. BIN  contrib/yaws/ebin/yaws_ticker.beam
  67. BIN  contrib/yaws/ebin/yaws_xmlrpc.beam
  68. BIN  contrib/yaws/ebin/yaws_zlib.beam
  69. +197 0 contrib/yaws/src/authmod_gssapi.erl
  70. +938 0 contrib/yaws/src/haxe.erl
  71. +735 0 contrib/yaws/src/json.erl
  72. +113 0 contrib/yaws/src/jsonrpc.erl
  73. +149 0 contrib/yaws/src/mime_type_c.erl
  74. +679 0 contrib/yaws/src/mime_types.erl
  75. +2,192 0 contrib/yaws/src/yaws.erl
  76. +71 0 contrib/yaws/src/yaws_404.erl
  77. +1,830 0 contrib/yaws/src/yaws_api.erl
  78. +23 0 contrib/yaws/src/yaws_app.erl
  79. +14 0 contrib/yaws/src/yaws_appmod_cgi.erl
  80. +546 0 contrib/yaws/src/yaws_cgi.erl
  81. +509 0 contrib/yaws/src/yaws_compile.erl
  82. +1,563 0 contrib/yaws/src/yaws_config.erl
  83. +2 0  contrib/yaws/src/yaws_configure.hrl
  84. +168 0 contrib/yaws/src/yaws_content_negotiation.erl
  85. +473 0 contrib/yaws/src/yaws_ctl.erl
  86. +547 0 contrib/yaws/src/yaws_dav.erl
  87. +651 0 contrib/yaws/src/yaws_debug.erl
  88. +85 0 contrib/yaws/src/yaws_debug.hrl
  89. +23 0 contrib/yaws/src/yaws_generated.erl
  90. +282 0 contrib/yaws/src/yaws_html.erl
  91. +223 0 contrib/yaws/src/yaws_jsonrpc.erl
  92. +495 0 contrib/yaws/src/yaws_log.erl
  93. +64 0 contrib/yaws/src/yaws_log_file_h.erl
  94. +366 0 contrib/yaws/src/yaws_ls.erl
  95. +290 0 contrib/yaws/src/yaws_pam.erl
  96. +425 0 contrib/yaws/src/yaws_revproxy.erl
  97. +320 0 contrib/yaws/src/yaws_rpc.erl
  98. +500 0 contrib/yaws/src/yaws_rss.erl
  99. +108 0 contrib/yaws/src/yaws_sendfile.erl
  100. +88 0 contrib/yaws/src/yaws_sendfile_compat.erl
  101. +4,181 0 contrib/yaws/src/yaws_server.erl
  102. +268 0 contrib/yaws/src/yaws_session_server.erl
  103. +93 0 contrib/yaws/src/yaws_showarg.erl
  104. +588 0 contrib/yaws/src/yaws_soap_lib.erl
  105. +235 0 contrib/yaws/src/yaws_soap_srv.erl
  106. +142 0 contrib/yaws/src/yaws_sup.erl
  107. +54 0 contrib/yaws/src/yaws_sup_restarts.erl
  108. +16 0 contrib/yaws/src/yaws_ticker.erl
  109. +61 0 contrib/yaws/src/yaws_vdir.erl
  110. +213 0 contrib/yaws/src/yaws_xmlrpc.erl
  111. +104 0 contrib/yaws/src/yaws_zlib.erl
  112. +317 0 contrib/yaws/src/ymnesia.erl
  113. +114 166 java-api/build.xml
  114. +32 10 src/admin.erl
  115. +1 1  src/bench_increment.erl
  116. +2 1  src/boot_server.erl
  117. +16 5 src/boot_sup.erl
  118. +1 1  src/boot_xmlrpc.erl
  119. +4 0 src/chordsharp.hrl
  120. +4 4 src/comm_layer/comm_acceptor.erl
  121. +6 6 src/comm_layer/comm_connection.erl
  122. +8 2 src/comm_layer/comm_layer.erl
  123. +2 2 src/comm_layer/comm_port.erl
  124. +13 3 src/config.erl
  125. +1 1  src/cs_api.erl
  126. +1 1  src/cs_db_otp.erl
  127. +4 4 src/cs_join.erl
  128. +6 1 src/cs_keyholder.erl
  129. +46 15 src/cs_node.erl
  130. +6 1 src/cs_send.erl
  131. +16 2 src/cs_state.erl
  132. +5 5 src/cs_sup_and.erl
  133. +24 5 src/cs_sup_or.erl
  134. +8 0 src/cs_sup_standalone.erl
  135. +41 50 src/cyclon/cache.erl
  136. +59 36 src/cyclon/cyclon.erl
  137. +108 0 src/dn_cache.erl
  138. +74 0 src/experiments.erl
  139. +123 76 src/failuredetector2.erl
  140. +32 0 src/fix_queue.erl
  141. +86 0 src/gen_component.erl
  142. +19 20 src/log.erl
  143. +9 1 src/lookup.erl
  144. +131 0 src/metric.erl
  145. +4 4 src/node_details.erl
  146. +16 2 src/ring_maintenance.erl
  147. +25 27 src/rm_chord.erl
  148. +408 0 src/rm_tman.erl
  149. +130 0 src/rse_chord.erl
  150. +30 8 src/rt_loop.erl
  151. +1 0  src/statistics.erl
  152. +61 0 src/tracer.erl
  153. +16 1 src/util.erl
  154. +11 6 src/webhelpers.erl
  155. +1 2  src/yaws_wrapper.erl
1  AUTHORS
@@ -5,3 +5,4 @@ Nico Kruber
5 5 Jeroen Vlek
6 6 Mikael Hoegqvist
7 7 Stefan Plantikow
  8 +Christian Hennig
2  Makefile.in
@@ -78,6 +78,8 @@ clean:
78 78 -rm -rf src/comm_layer/*.beam
79 79 -rm -rf src/pubsub/*.beam
80 80 -rm -rf src/transstore/*.beam
  81 + -rm -rf contrib/yaws/ebin/*.beam
  82 + -rm -rf contrib/log4erl/ebin/*.beam
81 83 -rm -rf test/*.beam
82 84 -rm -rf doc/*.html
83 85 -rm -rf doc/*.css
4 bin/boot.sh
@@ -20,4 +20,8 @@ if [ -f "$GLOBAL_CFG" ] ; then source "$GLOBAL_CFG" ; fi
20 20 if [ -f "$LOCAL_CFG" ] ; then source "$LOCAL_CFG" ; fi
21 21
22 22 export ERL_MAX_PORTS=16384
  23 +<<<<<<< .working
23 24 erl $ERL_OPTS +A 4 -setcookie "chocolate chip cookie" -pa ../contrib/yaws/ebin -pa ../ebin -yaws embedded true -connect_all false -hidden -sname boot@localhost -s boot
  25 +=======
  26 +erl $ERL_OPTS +S 4 +A 4 -setcookie "chocolate chip cookie" -pa ../contrib/log4erl/ebin -pa ../contrib/yaws/ebin -pa ../ebin -yaws embedded true -connect_all false -sname boot@localhost -s boot
  27 +>>>>>>> .merge-right.r186
4 bin/cs_local.sh
@@ -13,8 +13,8 @@
13 13 # See the License for the specific language governing permissions and
14 14 # limitations under the License.
15 15
16   -erl -setcookie "chocolate chip cookie" -pa ../contrib/yaws/ebin -pa ../ebin \
17   - -yaws embedded true -connect_all false -hidden \
  16 +erl +S 4 +A 4 -setcookie "chocolate chip cookie" -pa ../contrib/log4erl/ebin -pa ../contrib/yaws/ebin -pa ../ebin \
  17 + -yaws embedded true -connect_all false \
18 18 -chordsharp cs_port 14196 \
19 19 -chordsharp yaws_port 8001 \
20 20 -sname node@localhost -s chordsharp
4 bin/cs_local2.sh
@@ -13,8 +13,8 @@
13 13 # See the License for the specific language governing permissions and
14 14 # limitations under the License.
15 15
16   -erl -setcookie "chocolate chip cookie" -pa ../contrib/yaws/ebin -pa ../ebin \
17   - -yaws embedded true -connect_all false -hidden \
  16 +erl +S 4 +A 4 -setcookie "chocolate chip cookie" -pa ../contrib/log4erl/ebin -pa ../contrib/yaws/ebin -pa ../ebin \
  17 + -yaws embedded true -connect_all false \
18 18 -chordsharp cs_port 14197 \
19 19 -chordsharp yaws_port 8002 \
20 20 -sname node2 -s chordsharp
4 bin/cs_local3.sh
@@ -13,8 +13,8 @@
13 13 # See the License for the specific language governing permissions and
14 14 # limitations under the License.
15 15
16   -erl -setcookie "chocolate chip cookie" -pa ../contrib/yaws/ebin -pa ../ebin \
17   - -yaws embedded true -connect_all false -hidden \
  16 +erl +S 4 +A 4 -setcookie "chocolate chip cookie" -pa ../contrib/log4erl/ebin -pa ../contrib/yaws/ebin -pa ../ebin \
  17 + -yaws embedded true -connect_all false \
18 18 -chordsharp cs_port 14198 \
19 19 -chordsharp yaws_port 8003 \
20 20 -sname node3 -s chordsharp
29 bin/experiments.sh
... ... @@ -0,0 +1,29 @@
  1 +#!/bin/bash
  2 +# Copyright 2007-2008 Konrad-Zuse-Zentrum für Informationstechnik Berlin
  3 +#
  4 +# Licensed under the Apache License, Version 2.0 (the "License");
  5 +# you may not use this file except in compliance with the License.
  6 +# You may obtain a copy of the License at
  7 +#
  8 +# http://www.apache.org/licenses/LICENSE-2.0
  9 +#
  10 +# Unless required by applicable law or agreed to in writing, software
  11 +# distributed under the License is distributed on an "AS IS" BASIS,
  12 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 +# See the License for the specific language governing permissions and
  14 +# limitations under the License.
  15 +
  16 +DIRNAME=`dirname $0`
  17 +GLOBAL_CFG="$DIRNAME/scalaris.cfg.sh"
  18 +LOCAL_CFG="$DIRNAME/scalaris.local.cfg.sh"
  19 +if [ -f "$GLOBAL_CFG" ] ; then source "$GLOBAL_CFG" ; fi
  20 +if [ -f "$LOCAL_CFG" ] ; then source "$LOCAL_CFG" ; fi
  21 +
  22 +export ERL_MAX_PORTS=16384
  23 +
  24 +for i in $(seq 1 10); do
  25 + for i in $(seq 50 50 600); do
  26 + export RING_SIZE="$i" ;
  27 + erl $ERL_OPTS +S 4 +A 4 -setcookie "chocolate chip cookie" -pa ../contrib/log4erl/ebin -pa ../contrib/yaws/ebin -pa ../ebin -yaws embedded true -connect_all false -sname boot -s experiments ;
  28 + done
  29 +done
37 bin/scalaris.cfg
@@ -14,23 +14,41 @@
14 14 %
15 15 % $Id: chordsharp.cfg 494 2008-07-04 17:07:34Z schintke $
16 16
  17 +%% DeadNode Cache Parameters
  18 +%% @doc zombieDetectorInterval
  19 +{zombieDetectorInterval,60000}.
17 20
18   -%% @doc the length of the successor list
19   -{succ_list_length, 10}.
  21 +%% @doc how many dead nodes have to be observed
  22 +{zombieDetectorSize,10}.
  23 +
  24 +%% @doc Loglevel: debug < info < warn < error < fatal < none
  25 +{log_level, warn}.
  26 +
  27 +%% @doc LogFormat, see Readme for log4erl
  28 +%{log_format,"%j %t [%L] %l%n"}.
  29 +{log_format,"[%L] %l%n"}.
  30 +%% @doc the length of the successor list
  31 +{succ_list_length, 9}.
  32 +
  33 +%% @doc the length of the predecessor list
  34 +{pred_list_length, 1}.
20 35
21 36 %% @doc the number of milliseconds between two failure
22 37 %% detector checks
23   -{failure_detector_interval, 5000}.
  38 +{failure_detector_interval, 2000}.
24 39
25 40 %% @doc the number of milliseconds between two ping messages
26 41 %% several ping messages per failure_detector_interval are possible
27   -{failure_detector_ping_interval, 2000}.
  42 +{failure_detector_ping_interval, 1000}.
28 43
29 44 %% @doc the interval between two stabilization runs
30   -{stabilization_interval, 10000}.
  45 +{stabilization_interval_max, 10000}.
  46 +
  47 +%% @doc the interval between two stabilization runs if T-Man detected a change (only use by rm-tman)
  48 +{stabilization_interval_min, 10000}.
31 49
32 50 %% @doc the interval between two finger/pointer stabilization runs
33   -{pointer_stabilization_interval, 5000}.
  51 +{pointer_stabilization_interval, 30000}.
34 52
35 53 {failure_detector_update_interval, 30000}.
36 54
@@ -80,7 +98,7 @@
80 98
81 99 % cyclon
82 100 % cyclon enable
83   -{cyclon_enable,false}.
  101 +{cyclon_enable,true}.
84 102
85 103 %cyclon shuffle length
86 104 {cyclon_shuffle_length, 4}.
@@ -89,7 +107,7 @@
89 107 {cyclon_cache_size, 10}.
90 108
91 109 %cyclon interval
92   -{cyclon_interval, 10000}.
  110 +{cyclon_interval, 5000}.
93 111
94 112 % key_creation algorithm
95 113 {key_creator, random}.
@@ -108,3 +126,6 @@
108 126 % default assume local testing
109 127 {boot_host, {{127,0,0,1},14195,boot}}.
110 128 {log_host, {{127,0,0,1},14195,boot_logger}}.
  129 +
  130 +%{boot_host, {boot,'boot@htc026'}}.
  131 +%{log_host, {boot_logger, 'boot@htc026'}}.
40 contrib/log4erl/CHANGELOG.txt
... ... @@ -0,0 +1,40 @@
  1 +log4erl 0.8.3:
  2 +==============
  3 +* Added console_appender
  4 +* Added more modifiers to the possible pattern of formats (milliseconds, short/long name of month)
  5 +* Added an extra atom in the tuple argument for add_file_appender/2,3 for specifying format
  6 +
  7 +log4erl 0.8.2:
  8 +==============
  9 +* Fixed issues with log4erl process not part of the supervisor
  10 +* Added support for simple log formatters (similar to Layouts in Log4J)
  11 +* Added change_format/2,3
  12 +* Added change_log_level/1,2
  13 +* Added get_appenders/0,1
  14 +
  15 +Known issues:
  16 +- When file_appender crashes, the format is lost and log4erl will use the
  17 + default format
  18 +
  19 +log4erl 0.8.1:
  20 +==============
  21 +* Fixed unnecessary formatting of date/time for file_appender
  22 +* Added add_file_appender/2, add_file_appender/3
  23 +* Added add_dummy_appender/2, add_dummy_appender/3
  24 +
  25 +log4erl 0.8:
  26 +============
  27 +* Added the notion of appenders in order to allow different appenders
  28 +for loggers and changed API to reflect this
  29 +* Fixed restarting issues when appenders crash
  30 +* Added dummy_appender for testing multiple appenders
  31 +* Added get_appenders/0,1 function
  32 +
  33 +log4erl 0.7.1:
  34 +==============
  35 +* Changed default behaviour of new file_logger to append in order to preserve previous logs.
  36 +* Changed file_logger_guard.erl to logger_guard.erl because this module will be useful once more
  37 + logger types are added (e.g. SNMP loggers, Syslog loggers...).
  38 +* Added a function to change log level of loggers during run-time.
  39 +* moved utility functions in file_logger.erl to log4erl_utils.
  40 +* Added log_manager.erl in order to easily allow for more logger types
470 contrib/log4erl/LICENSE.txt
... ... @@ -0,0 +1,470 @@
  1 + MOZILLA PUBLIC LICENSE
  2 + Version 1.1
  3 +
  4 + ---------------
  5 +
  6 +1. Definitions.
  7 +
  8 + 1.0.1. "Commercial Use" means distribution or otherwise making the
  9 + Covered Code available to a third party.
  10 +
  11 + 1.1. "Contributor" means each entity that creates or contributes to
  12 + the creation of Modifications.
  13 +
  14 + 1.2. "Contributor Version" means the combination of the Original
  15 + Code, prior Modifications used by a Contributor, and the Modifications
  16 + made by that particular Contributor.
  17 +
  18 + 1.3. "Covered Code" means the Original Code or Modifications or the
  19 + combination of the Original Code and Modifications, in each case
  20 + including portions thereof.
  21 +
  22 + 1.4. "Electronic Distribution Mechanism" means a mechanism generally
  23 + accepted in the software development community for the electronic
  24 + transfer of data.
  25 +
  26 + 1.5. "Executable" means Covered Code in any form other than Source
  27 + Code.
  28 +
  29 + 1.6. "Initial Developer" means the individual or entity identified
  30 + as the Initial Developer in the Source Code notice required by Exhibit
  31 + A.
  32 +
  33 + 1.7. "Larger Work" means a work which combines Covered Code or
  34 + portions thereof with code not governed by the terms of this License.
  35 +
  36 + 1.8. "License" means this document.
  37 +
  38 + 1.8.1. "Licensable" means having the right to grant, to the maximum
  39 + extent possible, whether at the time of the initial grant or
  40 + subsequently acquired, any and all of the rights conveyed herein.
  41 +
  42 + 1.9. "Modifications" means any addition to or deletion from the
  43 + substance or structure of either the Original Code or any previous
  44 + Modifications. When Covered Code is released as a series of files, a
  45 + Modification is:
  46 + A. Any addition to or deletion from the contents of a file
  47 + containing Original Code or previous Modifications.
  48 +
  49 + B. Any new file that contains any part of the Original Code or
  50 + previous Modifications.
  51 +
  52 + 1.10. "Original Code" means Source Code of computer software code
  53 + which is described in the Source Code notice required by Exhibit A as
  54 + Original Code, and which, at the time of its release under this
  55 + License is not already Covered Code governed by this License.
  56 +
  57 + 1.10.1. "Patent Claims" means any patent claim(s), now owned or
  58 + hereafter acquired, including without limitation, method, process,
  59 + and apparatus claims, in any patent Licensable by grantor.
  60 +
  61 + 1.11. "Source Code" means the preferred form of the Covered Code for
  62 + making modifications to it, including all modules it contains, plus
  63 + any associated interface definition files, scripts used to control
  64 + compilation and installation of an Executable, or source code
  65 + differential comparisons against either the Original Code or another
  66 + well known, available Covered Code of the Contributor's choice. The
  67 + Source Code can be in a compressed or archival form, provided the
  68 + appropriate decompression or de-archiving software is widely available
  69 + for no charge.
  70 +
  71 + 1.12. "You" (or "Your") means an individual or a legal entity
  72 + exercising rights under, and complying with all of the terms of, this
  73 + License or a future version of this License issued under Section 6.1.
  74 + For legal entities, "You" includes any entity which controls, is
  75 + controlled by, or is under common control with You. For purposes of
  76 + this definition, "control" means (a) the power, direct or indirect,
  77 + to cause the direction or management of such entity, whether by
  78 + contract or otherwise, or (b) ownership of more than fifty percent
  79 + (50%) of the outstanding shares or beneficial ownership of such
  80 + entity.
  81 +
  82 +2. Source Code License.
  83 +
  84 + 2.1. The Initial Developer Grant.
  85 + The Initial Developer hereby grants You a world-wide, royalty-free,
  86 + non-exclusive license, subject to third party intellectual property
  87 + claims:
  88 + (a) under intellectual property rights (other than patent or
  89 + trademark) Licensable by Initial Developer to use, reproduce,
  90 + modify, display, perform, sublicense and distribute the Original
  91 + Code (or portions thereof) with or without Modifications, and/or
  92 + as part of a Larger Work; and
  93 +
  94 + (b) under Patents Claims infringed by the making, using or
  95 + selling of Original Code, to make, have made, use, practice,
  96 + sell, and offer for sale, and/or otherwise dispose of the
  97 + Original Code (or portions thereof).
  98 +
  99 + (c) the licenses granted in this Section 2.1(a) and (b) are
  100 + effective on the date Initial Developer first distributes
  101 + Original Code under the terms of this License.
  102 +
  103 + (d) Notwithstanding Section 2.1(b) above, no patent license is
  104 + granted: 1) for code that You delete from the Original Code; 2)
  105 + separate from the Original Code; or 3) for infringements caused
  106 + by: i) the modification of the Original Code or ii) the
  107 + combination of the Original Code with other software or devices.
  108 +
  109 + 2.2. Contributor Grant.
  110 + Subject to third party intellectual property claims, each Contributor
  111 + hereby grants You a world-wide, royalty-free, non-exclusive license
  112 +
  113 + (a) under intellectual property rights (other than patent or
  114 + trademark) Licensable by Contributor, to use, reproduce, modify,
  115 + display, perform, sublicense and distribute the Modifications
  116 + created by such Contributor (or portions thereof) either on an
  117 + unmodified basis, with other Modifications, as Covered Code
  118 + and/or as part of a Larger Work; and
  119 +
  120 + (b) under Patent Claims infringed by the making, using, or
  121 + selling of Modifications made by that Contributor either alone
  122 + and/or in combination with its Contributor Version (or portions
  123 + of such combination), to make, use, sell, offer for sale, have
  124 + made, and/or otherwise dispose of: 1) Modifications made by that
  125 + Contributor (or portions thereof); and 2) the combination of
  126 + Modifications made by that Contributor with its Contributor
  127 + Version (or portions of such combination).
  128 +
  129 + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
  130 + effective on the date Contributor first makes Commercial Use of
  131 + the Covered Code.
  132 +
  133 + (d) Notwithstanding Section 2.2(b) above, no patent license is
  134 + granted: 1) for any code that Contributor has deleted from the
  135 + Contributor Version; 2) separate from the Contributor Version;
  136 + 3) for infringements caused by: i) third party modifications of
  137 + Contributor Version or ii) the combination of Modifications made
  138 + by that Contributor with other software (except as part of the
  139 + Contributor Version) or other devices; or 4) under Patent Claims
  140 + infringed by Covered Code in the absence of Modifications made by
  141 + that Contributor.
  142 +
  143 +3. Distribution Obligations.
  144 +
  145 + 3.1. Application of License.
  146 + The Modifications which You create or to which You contribute are
  147 + governed by the terms of this License, including without limitation
  148 + Section 2.2. The Source Code version of Covered Code may be
  149 + distributed only under the terms of this License or a future version
  150 + of this License released under Section 6.1, and You must include a
  151 + copy of this License with every copy of the Source Code You
  152 + distribute. You may not offer or impose any terms on any Source Code
  153 + version that alters or restricts the applicable version of this
  154 + License or the recipients' rights hereunder. However, You may include
  155 + an additional document offering the additional rights described in
  156 + Section 3.5.
  157 +
  158 + 3.2. Availability of Source Code.
  159 + Any Modification which You create or to which You contribute must be
  160 + made available in Source Code form under the terms of this License
  161 + either on the same media as an Executable version or via an accepted
  162 + Electronic Distribution Mechanism to anyone to whom you made an
  163 + Executable version available; and if made available via Electronic
  164 + Distribution Mechanism, must remain available for at least twelve (12)
  165 + months after the date it initially became available, or at least six
  166 + (6) months after a subsequent version of that particular Modification
  167 + has been made available to such recipients. You are responsible for
  168 + ensuring that the Source Code version remains available even if the
  169 + Electronic Distribution Mechanism is maintained by a third party.
  170 +
  171 + 3.3. Description of Modifications.
  172 + You must cause all Covered Code to which You contribute to contain a
  173 + file documenting the changes You made to create that Covered Code and
  174 + the date of any change. You must include a prominent statement that
  175 + the Modification is derived, directly or indirectly, from Original
  176 + Code provided by the Initial Developer and including the name of the
  177 + Initial Developer in (a) the Source Code, and (b) in any notice in an
  178 + Executable version or related documentation in which You describe the
  179 + origin or ownership of the Covered Code.
  180 +
  181 + 3.4. Intellectual Property Matters
  182 + (a) Third Party Claims.
  183 + If Contributor has knowledge that a license under a third party's
  184 + intellectual property rights is required to exercise the rights
  185 + granted by such Contributor under Sections 2.1 or 2.2,
  186 + Contributor must include a text file with the Source Code
  187 + distribution titled "LEGAL" which describes the claim and the
  188 + party making the claim in sufficient detail that a recipient will
  189 + know whom to contact. If Contributor obtains such knowledge after
  190 + the Modification is made available as described in Section 3.2,
  191 + Contributor shall promptly modify the LEGAL file in all copies
  192 + Contributor makes available thereafter and shall take other steps
  193 + (such as notifying appropriate mailing lists or newsgroups)
  194 + reasonably calculated to inform those who received the Covered
  195 + Code that new knowledge has been obtained.
  196 +
  197 + (b) Contributor APIs.
  198 + If Contributor's Modifications include an application programming
  199 + interface and Contributor has knowledge of patent licenses which
  200 + are reasonably necessary to implement that API, Contributor must
  201 + also include this information in the LEGAL file.
  202 +
  203 + (c) Representations.
  204 + Contributor represents that, except as disclosed pursuant to
  205 + Section 3.4(a) above, Contributor believes that Contributor's
  206 + Modifications are Contributor's original creation(s) and/or
  207 + Contributor has sufficient rights to grant the rights conveyed by
  208 + this License.
  209 +
  210 + 3.5. Required Notices.
  211 + You must duplicate the notice in Exhibit A in each file of the Source
  212 + Code. If it is not possible to put such notice in a particular Source
  213 + Code file due to its structure, then You must include such notice in a
  214 + location (such as a relevant directory) where a user would be likely
  215 + to look for such a notice. If You created one or more Modification(s)
  216 + You may add your name as a Contributor to the notice described in
  217 + Exhibit A. You must also duplicate this License in any documentation
  218 + for the Source Code where You describe recipients' rights or ownership
  219 + rights relating to Covered Code. You may choose to offer, and to
  220 + charge a fee for, warranty, support, indemnity or liability
  221 + obligations to one or more recipients of Covered Code. However, You
  222 + may do so only on Your own behalf, and not on behalf of the Initial
  223 + Developer or any Contributor. You must make it absolutely clear than
  224 + any such warranty, support, indemnity or liability obligation is
  225 + offered by You alone, and You hereby agree to indemnify the Initial
  226 + Developer and every Contributor for any liability incurred by the
  227 + Initial Developer or such Contributor as a result of warranty,
  228 + support, indemnity or liability terms You offer.
  229 +
  230 + 3.6. Distribution of Executable Versions.
  231 + You may distribute Covered Code in Executable form only if the
  232 + requirements of Section 3.1-3.5 have been met for that Covered Code,
  233 + and if You include a notice stating that the Source Code version of
  234 + the Covered Code is available under the terms of this License,
  235 + including a description of how and where You have fulfilled the
  236 + obligations of Section 3.2. The notice must be conspicuously included
  237 + in any notice in an Executable version, related documentation or
  238 + collateral in which You describe recipients' rights relating to the
  239 + Covered Code. You may distribute the Executable version of Covered
  240 + Code or ownership rights under a license of Your choice, which may
  241 + contain terms different from this License, provided that You are in
  242 + compliance with the terms of this License and that the license for the
  243 + Executable version does not attempt to limit or alter the recipient's
  244 + rights in the Source Code version from the rights set forth in this
  245 + License. If You distribute the Executable version under a different
  246 + license You must make it absolutely clear that any terms which differ
  247 + from this License are offered by You alone, not by the Initial
  248 + Developer or any Contributor. You hereby agree to indemnify the
  249 + Initial Developer and every Contributor for any liability incurred by
  250 + the Initial Developer or such Contributor as a result of any such
  251 + terms You offer.
  252 +
  253 + 3.7. Larger Works.
  254 + You may create a Larger Work by combining Covered Code with other code
  255 + not governed by the terms of this License and distribute the Larger
  256 + Work as a single product. In such a case, You must make sure the
  257 + requirements of this License are fulfilled for the Covered Code.
  258 +
  259 +4. Inability to Comply Due to Statute or Regulation.
  260 +
  261 + If it is impossible for You to comply with any of the terms of this
  262 + License with respect to some or all of the Covered Code due to
  263 + statute, judicial order, or regulation then You must: (a) comply with
  264 + the terms of this License to the maximum extent possible; and (b)
  265 + describe the limitations and the code they affect. Such description
  266 + must be included in the LEGAL file described in Section 3.4 and must
  267 + be included with all distributions of the Source Code. Except to the
  268 + extent prohibited by statute or regulation, such description must be
  269 + sufficiently detailed for a recipient of ordinary skill to be able to
  270 + understand it.
  271 +
  272 +5. Application of this License.
  273 +
  274 + This License applies to code to which the Initial Developer has
  275 + attached the notice in Exhibit A and to related Covered Code.
  276 +
  277 +6. Versions of the License.
  278 +
  279 + 6.1. New Versions.
  280 + Netscape Communications Corporation ("Netscape") may publish revised
  281 + and/or new versions of the License from time to time. Each version
  282 + will be given a distinguishing version number.
  283 +
  284 + 6.2. Effect of New Versions.
  285 + Once Covered Code has been published under a particular version of the
  286 + License, You may always continue to use it under the terms of that
  287 + version. You may also choose to use such Covered Code under the terms
  288 + of any subsequent version of the License published by Netscape. No one
  289 + other than Netscape has the right to modify the terms applicable to
  290 + Covered Code created under this License.
  291 +
  292 + 6.3. Derivative Works.
  293 + If You create or use a modified version of this License (which you may
  294 + only do in order to apply it to code which is not already Covered Code
  295 + governed by this License), You must (a) rename Your license so that
  296 + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
  297 + "MPL", "NPL" or any confusingly similar phrase do not appear in your
  298 + license (except to note that your license differs from this License)
  299 + and (b) otherwise make it clear that Your version of the license
  300 + contains terms which differ from the Mozilla Public License and
  301 + Netscape Public License. (Filling in the name of the Initial
  302 + Developer, Original Code or Contributor in the notice described in
  303 + Exhibit A shall not of themselves be deemed to be modifications of
  304 + this License.)
  305 +
  306 +7. DISCLAIMER OF WARRANTY.
  307 +
  308 + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
  309 + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  310 + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
  311 + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
  312 + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
  313 + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
  314 + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
  315 + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
  316 + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
  317 + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
  318 +
  319 +8. TERMINATION.
  320 +
  321 + 8.1. This License and the rights granted hereunder will terminate
  322 + automatically if You fail to comply with terms herein and fail to cure
  323 + such breach within 30 days of becoming aware of the breach. All
  324 + sublicenses to the Covered Code which are properly granted shall
  325 + survive any termination of this License. Provisions which, by their
  326 + nature, must remain in effect beyond the termination of this License
  327 + shall survive.
  328 +
  329 + 8.2. If You initiate litigation by asserting a patent infringement
  330 + claim (excluding declatory judgment actions) against Initial Developer
  331 + or a Contributor (the Initial Developer or Contributor against whom
  332 + You file such action is referred to as "Participant") alleging that:
  333 +
  334 + (a) such Participant's Contributor Version directly or indirectly
  335 + infringes any patent, then any and all rights granted by such
  336 + Participant to You under Sections 2.1 and/or 2.2 of this License
  337 + shall, upon 60 days notice from Participant terminate prospectively,
  338 + unless if within 60 days after receipt of notice You either: (i)
  339 + agree in writing to pay Participant a mutually agreeable reasonable
  340 + royalty for Your past and future use of Modifications made by such
  341 + Participant, or (ii) withdraw Your litigation claim with respect to
  342 + the Contributor Version against such Participant. If within 60 days
  343 + of notice, a reasonable royalty and payment arrangement are not
  344 + mutually agreed upon in writing by the parties or the litigation claim
  345 + is not withdrawn, the rights granted by Participant to You under
  346 + Sections 2.1 and/or 2.2 automatically terminate at the expiration of
  347 + the 60 day notice period specified above.
  348 +
  349 + (b) any software, hardware, or device, other than such Participant's
  350 + Contributor Version, directly or indirectly infringes any patent, then
  351 + any rights granted to You by such Participant under Sections 2.1(b)
  352 + and 2.2(b) are revoked effective as of the date You first made, used,
  353 + sold, distributed, or had made, Modifications made by that
  354 + Participant.
  355 +
  356 + 8.3. If You assert a patent infringement claim against Participant
  357 + alleging that such Participant's Contributor Version directly or
  358 + indirectly infringes any patent where such claim is resolved (such as
  359 + by license or settlement) prior to the initiation of patent
  360 + infringement litigation, then the reasonable value of the licenses
  361 + granted by such Participant under Sections 2.1 or 2.2 shall be taken
  362 + into account in determining the amount or value of any payment or
  363 + license.
  364 +
  365 + 8.4. In the event of termination under Sections 8.1 or 8.2 above,
  366 + all end user license agreements (excluding distributors and resellers)
  367 + which have been validly granted by You or any distributor hereunder
  368 + prior to termination shall survive termination.
  369 +
  370 +9. LIMITATION OF LIABILITY.
  371 +
  372 + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
  373 + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
  374 + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
  375 + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
  376 + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
  377 + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
  378 + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
  379 + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
  380 + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
  381 + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
  382 + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
  383 + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
  384 + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
  385 + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
  386 +
  387 +10. U.S. GOVERNMENT END USERS.
  388 +
  389 + The Covered Code is a "commercial item," as that term is defined in
  390 + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
  391 + software" and "commercial computer software documentation," as such
  392 + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
  393 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
  394 + all U.S. Government End Users acquire Covered Code with only those
  395 + rights set forth herein.
  396 +
  397 +11. MISCELLANEOUS.
  398 +
  399 + This License represents the complete agreement concerning subject
  400 + matter hereof. If any provision of this License is held to be
  401 + unenforceable, such provision shall be reformed only to the extent
  402 + necessary to make it enforceable. This License shall be governed by
  403 + California law provisions (except to the extent applicable law, if
  404 + any, provides otherwise), excluding its conflict-of-law provisions.
  405 + With respect to disputes in which at least one party is a citizen of,
  406 + or an entity chartered or registered to do business in the United
  407 + States of America, any litigation relating to this License shall be
  408 + subject to the jurisdiction of the Federal Courts of the Northern
  409 + District of California, with venue lying in Santa Clara County,
  410 + California, with the losing party responsible for costs, including
  411 + without limitation, court costs and reasonable attorneys' fees and
  412 + expenses. The application of the United Nations Convention on
  413 + Contracts for the International Sale of Goods is expressly excluded.
  414 + Any law or regulation which provides that the language of a contract
  415 + shall be construed against the drafter shall not apply to this
  416 + License.
  417 +
  418 +12. RESPONSIBILITY FOR CLAIMS.
  419 +
  420 + As between Initial Developer and the Contributors, each party is
  421 + responsible for claims and damages arising, directly or indirectly,
  422 + out of its utilization of rights under this License and You agree to
  423 + work with Initial Developer and Contributors to distribute such
  424 + responsibility on an equitable basis. Nothing herein is intended or
  425 + shall be deemed to constitute any admission of liability.
  426 +
  427 +13. MULTIPLE-LICENSED CODE.
  428 +
  429 + Initial Developer may designate portions of the Covered Code as
  430 + "Multiple-Licensed". "Multiple-Licensed" means that the Initial
  431 + Developer permits you to utilize portions of the Covered Code under
  432 + Your choice of the NPL or the alternative licenses, if any, specified
  433 + by the Initial Developer in the file described in Exhibit A.
  434 +
  435 +EXHIBIT A -Mozilla Public License.
  436 +
  437 + ``The contents of this file are subject to the Mozilla Public License
  438 + Version 1.1 (the "License"); you may not use this file except in
  439 + compliance with the License. You may obtain a copy of the License at
  440 + http://www.mozilla.org/MPL/
  441 +
  442 + Software distributed under the License is distributed on an "AS IS"
  443 + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  444 + License for the specific language governing rights and limitations
  445 + under the License.
  446 +
  447 + The Original Code is ______________________________________.
  448 +
  449 + The Initial Developer of the Original Code is ________________________.
  450 + Portions created by ______________________ are Copyright (C) ______
  451 + _______________________. All Rights Reserved.
  452 +
  453 + Contributor(s): ______________________________________.
  454 +
  455 + Alternatively, the contents of this file may be used under the terms
  456 + of the _____ license (the "[___] License"), in which case the
  457 + provisions of [______] License are applicable instead of those
  458 + above. If you wish to allow use of your version of this file only
  459 + under the terms of the [____] License and not to allow others to use
  460 + your version of this file under the MPL, indicate your decision by
  461 + deleting the provisions above and replace them with the notice and
  462 + other provisions required by the [___] License. If you do not delete
  463 + the provisions above, a recipient may use your version of this file
  464 + under either the MPL or the [___] License."
  465 +
  466 + [NOTE: The text of this Exhibit A may differ slightly from the text of
  467 + the notices in the Source Code files of the Original Code. You should
  468 + use the text of this Exhibit A rather than the text found in the
  469 + Original Code Source Code for Your Modifications.]
  470 +
17 contrib/log4erl/Makefile
... ... @@ -0,0 +1,17 @@
  1 +SRC = src
  2 +
  3 +all: subdirs
  4 +
  5 +subdirs:
  6 + cd ${SRC}; make
  7 +
  8 +# remove all the code
  9 +clean:
  10 + rm -rf ebin/*.beam erl_crash.dump
  11 + rm -f *~
  12 + rm -f src/*~
  13 + rm -f ebin/*~
  14 + rm -f include/*~
  15 +# cd dir1; make clean
  16 +#install:
  17 +# cp -f ebin/* ../../www/ebin
256 contrib/log4erl/README.txt
... ... @@ -0,0 +1,256 @@
  1 +log4erl Manual:
  2 +===============
  3 +
  4 +TOC:
  5 +====
  6 +1. Features
  7 +2. Installation
  8 +3. Usage
  9 +4. API
  10 +5. Known issues
  11 +6. Future development
  12 +7. License
  13 +
  14 +1. FEATURES:
  15 +============
  16 +- Multiple logs
  17 +- Currently, only size-based log rotation of files for file appender
  18 +- Support default logger if no logger specified
  19 +- 5 predifined log levels (debug, info, warn, error, fatal)
  20 +- Support for user-specified log levels
  21 +- Support for simple log formatter (similar to Layouts in Log4J)
  22 +- Support for console log
  23 +
  24 +2. INSTALLATION:
  25 +================
  26 +To compile & install log4erl, download source from google code's website
  27 +(http://code.google.com/p/log4erl/) or from svn:
  28 +$> svn checkout http://log4erl.googlecode.com/svn/trunk/ log4erl
  29 +$> cd log4erl
  30 +$> make
  31 +
  32 +or you can run the below from erlang shell:
  33 +
  34 +$> cd src
  35 +$> erl
  36 +1> make:all([{outdir, "../ebin"}]).
  37 +
  38 +3. USAGE:
  39 +=========
  40 +1- In order to use log4erl, you need to first include it in the path. There
  41 +are 2 ways to do this:
  42 +a) include the "log4erl" directory in erlang's "lib" directory in the target
  43 +machine (cp -Rf log4erl /where/erlang/is/lib).
  44 +$> cp -Rf log4erl /usr/local/lib/erlang/lib/
  45 +
  46 +b) include the "log4erl" ebin directory in the path when running you program
  47 +$> erl -pz /path/to/log4erl ...
  48 +
  49 +2- Once the log4erl directory is included, you can use its API as described in section "API". but before,
  50 +you need to run:
  51 +> application:start(log4erl).
  52 +
  53 +3- Create loggers & add appenders to them as appropriate. You can do this as per the API below.
  54 +> log4erl:add_logger(messages_log).
  55 +> log4erl:add_file_appender(messages_log, file_logs, Conf).
  56 + where Conf is the configuration file or erlang term describing how the log is to be handled
  57 +
  58 +4- Additionally, you can change format of file logs
  59 +> log4erl:change_format(messages_log, file_logs, Format).
  60 + where Format is formatting string as described in API. Note that you can also set the format
  61 + in the Conf tuple in log4erl:add_file_appender.
  62 +
  63 +5- Now, you can log whatever messages you like as per logging functions described in API.
  64 +
  65 +Precedance of log levels are:
  66 +all = debug < info < warn < error < fatal < none
  67 +User defined levels are always written except when none level is specified in the logger specification
  68 +(See below).
  69 +
  70 +4. API:
  71 +=======
  72 +NOTE:
  73 +-----
  74 +Please be informed that the API below as of now is not stable and any of the functions/parameters below
  75 +may be changed without prior notice.
  76 +
  77 +**> log4erl:add_logger(Name) -> ok | {error, E}
  78 + Name :: atom() name of the logger
  79 +
  80 + Example:
  81 + log4erl:add_logger(chat_logger)
  82 + This will create a new logger with name 'chat_logger"
  83 +
  84 +**> log4erl:add_file_appender(Name, Spec) -> ok | {error, E}
  85 + Name :: atom() name of the appender. This value will be used
  86 + to uniquely references this file appender and can be used to
  87 + change log level and format of the appended file. This appender
  88 + will be added to the default_logger
  89 +
  90 + Spec :: tuple() of the form
  91 + {LogDir, LogFileName, {size, Size}, NumOfRotations, Suffix, LogLevel}
  92 + or
  93 + {LogDir, LogFileName, {size, Size}, NumOfRotations, Suffix, LogLevel, Format}
  94 + This tuple defines the appender's attributes.
  95 +
  96 + Example:
  97 + log4erl:add_file_appender(chat_room1, {"../logs", "room1", {size, 100000}, 4, "txt", warn}).
  98 + This will directs log4erl to create a file appender and add it to the default
  99 + logger. all log messages towards default logger will be written to file
  100 + "../logs/room1.txt". The file will have a size limit of 100000, after which
  101 + the file will be rotated for 4 times. The log level will be warn, which means
  102 + info & debug messages will not be written. Format is a list of specifiers. The meanin of these
  103 + specifiers can be found in description of log4erl:change_format/2 below.
  104 +
  105 + After suffeciantly long time, the directory "../logs" will look like this:
  106 + $> ls -l
  107 + -rw-rw-r-- 1 ahmed ahmed 103845 Jun 25 11:41 logger1_2.elog
  108 + -rw-rw-r-- 1 ahmed ahmed 102095 Jun 25 11:41 logger1_3.elog
  109 + -rw-rw-r-- 1 ahmed ahmed 106435 Jun 25 11:41 logger1_4.elog
  110 + -rw-rw-r-- 1 ahmed ahmed 103390 Jun 25 11:41 logger1_1.elog
  111 + -rw-rw-r-- 1 ahmed ahmed 7385 Jun 25 11:41 logger1.elog
  112 +
  113 +**> log4erl:add_file_appender(Logger, Appender, SpecFile) -> ok
  114 + Logger :: atom()
  115 + Appender :: atom()
  116 +
  117 + This will create a new appender and associate spec in Spec or in SpecFile to it. Spec and
  118 + content of SpecFile are the same as in add_file_appender/2
  119 +
  120 + Example:
  121 + log4erl:add_file_appender(chat_log, file_logger, "../priv/chat_logs.conf").
  122 + This will add another logger with the name "chat_log" and use configuration in
  123 + the file "../priv/chat_logs.conf" for it. To write to this log, you need to specify
  124 + the name of the logger.
  125 +
  126 +**> log4erl:add_console_appender(Appender, Spec) -> ok
  127 + log4erl:add_console_appender(Logger, Appender, Spec) -> ok
  128 + Logger :: atom()
  129 + Appender :: atom()
  130 + Spec :: tuple()
  131 +
  132 + This will create a new console appender to either Logger or default logger and associate spec in Spec to it.
  133 + Spec is in the form {Level, Format}, which means exactly as it is in file_appender Spec
  134 +
  135 + Example:
  136 + log4erl:add_console_appender(cmd_logs, {info, "%j %T [%L] %l%n"}).
  137 +
  138 +**> log4erl:change_log_level(Level) -> ok
  139 + log4erl:change_log_level(Logger, Level) -> ok
  140 + Level::atom() = {all, debug, info, error, warn, fatal, none}
  141 + Logger::atom()
  142 +
  143 + This will change log level for default logger or named logger to the level
  144 + specified.
  145 +
  146 + Example:
  147 + log4erl:change_log_level(info). %% This will change level of default logger to info
  148 + log4erl:change_log_level(test_log, warn) %% This will change level of test_log logger to warn
  149 +
  150 +**> log4erl:change_format(Appender, Format) -> ok
  151 + log4erl:change_format(Logger, Appender, Format) -> ok
  152 + Appender :: atom()
  153 + Logger :: atom()
  154 + Format :: string()
  155 +
  156 + @since version 0.8.3
  157 +
  158 + This will change the output format to the specified Format. Format is a pattern string similar to
  159 + PatternLayout in Log4j. patterns is an arbitrary string with specifiers (proceeded by '%').
  160 + Possible specifiers are below:
  161 + d - output date (1-2-2008)
  162 + j - output date (01-02-2008)
  163 + t - time (2:13:9)
  164 + T - time (02:28:01,811637)
  165 + y - year in YY format (08)
  166 + Y - year in YYYY format (2008)
  167 + M - month (2)
  168 + b - short name of month (Feb)
  169 + B - long name of month (February)
  170 + D - day
  171 + h - hour
  172 + m - minute
  173 + s - second
  174 + i - milli-seconds
  175 + l - the actual log message
  176 + L - log level
  177 + n - new line
  178 + % - the percentage sign (%)
  179 +
  180 + Example:
  181 + log4erl:change_format(file1, "%j %T [%L] %l%n").
  182 + Will result in the following output (on log4erl:warn("hello"))
  183 +
  184 + 27-10-2008 15:28:59,98621 [warn] hello
  185 +
  186 +**> log4erl:log(Level, Log) -> ok
  187 + Level :: atom()
  188 + Log :: string()
  189 +
  190 + This will log the text Log to the default logger with level Level.
  191 +
  192 + Example:
  193 + log4erl:log(warn, "Hello there").
  194 + log4erl:log(test_level, "Hello there").
  195 +
  196 +**> log4erl:log(Level, Log, Data) -> ok
  197 + Level :: atom()
  198 + Log :: string()
  199 + Data :: list()
  200 +
  201 + This will log the text Log to the default logger with level Level and
  202 + will use Data to format the log text.
  203 +
  204 + Example:
  205 + log4erl:log(info, "received message ~p", [Msg]).
  206 +
  207 +**> log4erl:log(Logger, Level, Log, Data) -> ok
  208 + Logger :: atom()
  209 + Level :: atom()
  210 + Log :: string()
  211 + Data :: list()
  212 +
  213 + This will log the (Log, Data) to Logger with level Level
  214 +
  215 + Example:
  216 + log4erl:log(chat_log, debug, "user entered chat text: ~p", [Chat]).
  217 +
  218 +**> log4erl:Level(Log) -> ok
  219 + log4erl:Level(Log, Data) -> ok
  220 + log4erl:Level(Logger, Data) -> ok
  221 + log4erl:Level(Logger, Log, Data) -> ok
  222 +
  223 + Level :: warn | info | error | fatal | debug
  224 + Logger :: atom()
  225 + Log :: string()
  226 + Data :: list()
  227 +
  228 + Exmaple:
  229 + log4erl:info("This is an info msg").
  230 + log4erl:warn("Received error ~p",[Msg]).
  231 + log4erl:fatal(chat_log, "exception occured").
  232 + log4erl:debug(chat_log, "message received is ~p", [Msg]).
  233 + log4erl:error("Error").
  234 +
  235 +5. KNOWN ISSUES:
  236 +================
  237 +- Name of both loggers & appenders should be unique and not registered since log4erl will try and register
  238 + their names. If the name is already registered, nothing will happen. This will be fixed soon.
  239 +- If you run change_log_format/1,2 and appender crashed, a restart from the supervisor will not record the latest
  240 + format used. It will only use either the default format or the format used in the argument is supplied.
  241 +
  242 +6. FUTURE DEVELOPMENT:
  243 +======================
  244 +- Add support for extensive file-based configuration
  245 +- Add support for different log persistance methods (e.g files, XML, console, DB, SNMP, syslog...etc)
  246 +- Add support for time-based log rotation
  247 +- Multiple configuration format (Erlang terms, XML?, properties files?)
  248 +- Add support for NDC & MDC ???
  249 +
  250 +Please send your suggestion to ahmed.nawras <at @ at> gmail <dot . dot> com
  251 +
  252 +7. LICENSE:
  253 +===========
  254 +This software is subject to "Mozilla Public License 1.1". You can find the license terms
  255 +in the file 'LICENSE.txt' shipping along with the source code. You may also get a copy
  256 +of the license term from the URL: "http://www.mozilla.org/MPL/MPL-1.1.html".
18 contrib/log4erl/TODO.txt
... ... @@ -0,0 +1,18 @@
  1 +TODO:
  2 +=====
  3 +
  4 +* Add formatters functions that can be added to appenders to change
  5 +default formatting patters [DONE]
  6 +* Add support for pattern appender [DONE]
  7 +* Update manual [DONE (latest for log4erl 0.8.2)]
  8 +* Add performance benchmarks
  9 +* Add support for file-based configuration to log4erl instead of only
  10 +programmable-only configuration that is working now
  11 +* Add support for SNMP appender
  12 +* Add support for DB appender (MySQL, Postgres?, Mnesia,...etc)
  13 +* Add support for SMTP appender
  14 +* Add support for NT event appender
  15 +* Add support for syslog appender
  16 +* Add support for NDC/MDC
  17 +* Add support for time-based log rotation (file_appender)
  18 +
11 contrib/log4erl/ebin/log4erl.app
... ... @@ -0,0 +1,11 @@
  1 +%% This is the application resource file (.app file) for the 'base'
  2 +%% application.
  3 +{application, log4erl,
  4 +[{description, "Logger for erlang in the spirit of Log4J"},
  5 + {vsn, "0.8.3"},
  6 + {modules, [log4erl]},
  7 + {registered,[log4erl]},
  8 + {applications, [kernel,stdlib]},
  9 + {mod, {log4erl,[default_logger]}},
  10 + {start_phases, []}
  11 +]}.
46 contrib/log4erl/include/log4erl.hrl
... ... @@ -0,0 +1,46 @@
  1 +-define(ROTATION_CHECK, 10).
  2 +
  3 +-define(DEFAULT_CONF,"log4erl.conf").
  4 +
  5 +-define(DEFAULT_FORMAT, "[%L] %l%n").
  6 +
  7 +-define(DEFAULT_LEVEL, warn).
  8 +
  9 +-define(DEFAULT_LOGGER, default_logger).
  10 +-define(DEFAULT_LOGGER_GUARD, default_logger_guard).
  11 +
  12 +-define(FILE_OPTIONS,[write, raw, binary, append]).
  13 +-define(FILE_OPTIONS_ROTATE,[write, raw, binary]).
  14 +
  15 +%-define(DEBUG, true).
  16 +
  17 +-ifdef(DEBUG).
  18 +-define(LOG(X), io:format("~p: " ++ X,[?MODULE])).
  19 +-define(LOG2(X,D), io:format("~p: " ++ X,[?MODULE | D])).
  20 +-else.
  21 +-define(LOG(_X), ok).
  22 +-define(LOG2(_X,_D), ok).
  23 +-endif.
  24 +
  25 +
  26 +%% type = time | size
  27 +%% max = seconds (for time) | or kiloBytes (for size)
  28 +-record(log_type,{type, max, timer}).
  29 +
  30 +%% file_name = the name of the file without counter
  31 +%% fd = the descriptior for the file
  32 +%% counter = current counter, used for appending to file_name in case of rotation
  33 +%% log_type is a log_type record
  34 +%% rotation = number of rotation before the logger wraps around the coutner (>1)
  35 +%% suffix = suffix of file name (e.g. txt)
  36 +%% The filename of a log is file_name ++ "_" ++ counter ++ "." ++ suffix
  37 +%% e.g. log_1.txt
  38 +%% tokens = format tokens generated from log_formatter:parse/1
  39 +-record(file_appender, {dir, file_name, fd, counter, log_type, rotation, suffix, level, format}).
  40 +
  41 +-record(console_appender, {level, format}).
  42 +
  43 +-record(rotation_state, {state, timer}).
  44 +
  45 +%% log record
  46 +-record(log, {level, msg, data, time, millis}).
1  contrib/log4erl/priv/file_logger.conf
... ... @@ -0,0 +1 @@
  1 +{"../logs", "flogger", {size, 10000}, 3, "txt", all}.
1  contrib/log4erl/priv/logger1.conf
... ... @@ -0,0 +1 @@
  1 +{"../logs", "logger1", {size, 1000000}, -3, "logs", all}.
1  contrib/log4erl/priv/logger2.conf
... ... @@ -0,0 +1 @@
  1 +{"../logs","logger2", {size, 500000}, 2, "elog", all}.
46 contrib/log4erl/src/Makefile
... ... @@ -0,0 +1,46 @@
  1 +# leave these lines alone
  2 +.SUFFIXES: .erl .beam .yrl
  3 +
  4 +.erl.beam:
  5 + erlc -o $(EBIN_DIR) -W $<
  6 +
  7 +.yrl.erl:
  8 + erlc -o $(EBIN_DIR) -W $<
  9 +
  10 +SOURCE_DIR=src
  11 +EBIN_DIR=../ebin
  12 +INCLUDE_DIR=include
  13 +#SRC=$(wildcard $(SOURCE_DIR)/*)
  14 +ERL = erl -o $(EBIN_DIR) -I ${INCLUDE_DIR}
  15 +SRC = src
  16 +
  17 +# Here's a list of the erlang modules you want compiling
  18 +# If the modules don't fit onto one line add a \ character
  19 +# to the end of the line and continue on the next line
  20 +# Edit the lines below
  21 +MODS = log4erl_sup log4erl file_appender console_appender log_manager logger_guard log4erl_utils dummy_appender log_formatter
  22 +
  23 +all: compile
  24 +
  25 +#compile: ${MODS:%=%.beam} #application
  26 +#compile: ${SRC}/${MODS:%=%.beam}