├── .editorconfig ├── .github └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── README.md ├── log4js-servlet ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ ├── main │ ├── java │ │ └── de │ │ │ └── log4js │ │ │ ├── Log4jsServlet.java │ │ │ ├── LogLevel.java │ │ │ ├── LoggingEvent.java │ │ │ ├── adapter │ │ │ ├── Adapter.java │ │ │ ├── JavaLoggingAdapter.java │ │ │ └── Log4jAdapter.java │ │ │ └── parser │ │ │ ├── EventParser.java │ │ │ ├── JsonEventParser.java │ │ │ ├── ParseException.java │ │ │ └── XmlEventParser.java │ ├── resources │ │ └── log4j.properties │ └── webapp │ │ ├── WEB-INF │ │ └── web.xml │ │ └── index.jsp │ └── test │ └── java │ └── de │ └── log4js │ ├── Log4jsServletTest.java │ ├── TestUtil.java │ ├── adapter │ ├── JavaLoggingAdapterTest.java │ └── Log4jAdapterTest.java │ └── parser │ ├── JsonEventParserTest.java │ └── XmlEventParserTest.java ├── log4js-site ├── .project ├── forrest.properties ├── forrest.properties.xml ├── logo │ └── 1.0 │ │ ├── 1.0.collors.png │ │ ├── 1.0.png │ │ ├── 1.0_70px.png │ │ ├── 1.0_favicon.png │ │ ├── dot_blue.png │ │ ├── dot_grey.png │ │ ├── dot_lightblue.png │ │ ├── dot_orange.png │ │ └── exports │ │ ├── 1.0.collors.jpg │ │ ├── 1.0.jpg │ │ ├── 1.0_70px.jpg │ │ ├── dot_blue.gif │ │ ├── dot_grey.gif │ │ ├── dot_lightblue.gif │ │ ├── dot_orange.gif │ │ └── favicon.ico ├── status.xml └── xdocs │ ├── README.txt │ ├── classes │ └── CatalogManager.properties │ ├── conf │ └── cli.xconf │ ├── content │ ├── doap.xml │ └── xdocs │ │ ├── architecture.aart │ │ ├── committer.xml │ │ ├── credits.xml │ │ ├── docu │ │ ├── faq.xml │ │ ├── index.xml │ │ └── users-guide.xml │ │ ├── examples.html │ │ ├── favicon.ico │ │ ├── images │ │ ├── group-logo.gif │ │ ├── group.svg │ │ ├── icon.png │ │ ├── project-logo.gif │ │ ├── project.svg │ │ └── usemap.gif │ │ ├── index.xml │ │ ├── license.xml │ │ ├── links.xml │ │ ├── robots.txt │ │ ├── site.xml │ │ └── tabs.xml │ ├── locationmap.xml │ ├── resources.xmap │ ├── resources │ ├── images │ │ ├── Log4JS-UML.jpg │ │ ├── project-logo.jpg │ │ ├── project-logo.png │ │ └── users-guide │ │ │ └── consoleExample.jpg │ ├── js │ │ ├── shBrushCss.js │ │ ├── shBrushJScript.js │ │ ├── shBrushJava.js │ │ ├── shBrushXml.js │ │ └── shCore.js │ ├── schema │ │ └── catalog.xcat │ └── stylesheets │ │ └── SyntaxHighlighter.css │ ├── sitemap.xml │ ├── skinconf.xml │ ├── skins │ ├── common │ │ ├── css │ │ │ └── forrest.css.xslt │ │ ├── images │ │ │ ├── README.txt │ │ │ ├── add.jpg │ │ │ ├── built-with-forrest-button.png │ │ │ ├── corner-imports.svg.xslt │ │ │ ├── dc.svg.xslt │ │ │ ├── external-link.gif │ │ │ ├── fix.jpg │ │ │ ├── forrest-credit-logo.png │ │ │ ├── hack.jpg │ │ │ ├── pdfdoc.gif │ │ │ ├── poddoc.png │ │ │ ├── poddoc.svg.xslt │ │ │ ├── printer.gif │ │ │ ├── rc.svg.xslt │ │ │ ├── remove.jpg │ │ │ ├── rss.png │ │ │ ├── spacer.gif │ │ │ ├── txtdoc.png │ │ │ ├── txtdoc.svg.xslt │ │ │ ├── update.jpg │ │ │ ├── valid-html401.png │ │ │ ├── vcss.png │ │ │ └── xmldoc.gif │ │ ├── scripts │ │ │ ├── breadcrumbs-optimized.js │ │ │ ├── breadcrumbs.js │ │ │ ├── fontsize.js │ │ │ ├── getBlank.js │ │ │ ├── getMenu.js │ │ │ ├── menu.js │ │ │ └── prototype.js │ │ ├── skinconf.xsl │ │ ├── translations │ │ │ ├── CommonMessages_de.xml │ │ │ ├── CommonMessages_en_US.xml │ │ │ ├── CommonMessages_es.xml │ │ │ └── CommonMessages_fr.xml │ │ └── xslt │ │ │ ├── fo │ │ │ ├── document-to-fo.xsl │ │ │ ├── footerinfo.xsl │ │ │ └── pdfoutline.xsl │ │ │ ├── html │ │ │ ├── book-to-menu.xsl │ │ │ ├── document-to-html.xsl │ │ │ ├── dotdots.xsl │ │ │ ├── pathutils.xsl │ │ │ ├── renderlogo.xsl │ │ │ ├── site-to-xhtml.xsl │ │ │ ├── split.xsl │ │ │ ├── strip_namespaces.xsl │ │ │ ├── tab-to-menu.xsl │ │ │ └── tabutils.xsl │ │ │ └── svg │ │ │ └── document-to-svg.xsl │ └── pelt │ │ ├── book-to-menu.xsl │ │ ├── css │ │ ├── basic.css │ │ ├── print.css │ │ ├── profile.css.xslt │ │ └── screen.css │ │ ├── document-to-html.xsl │ │ ├── images │ │ ├── chapter.gif │ │ ├── chapter_open.gif │ │ ├── current.gif │ │ ├── error.png │ │ ├── header_white_line.gif │ │ ├── info.png │ │ ├── instruction_arrow.png │ │ ├── label.gif │ │ ├── page.gif │ │ ├── pdfdoc.gif │ │ ├── printer.gif │ │ ├── success.png │ │ ├── warning.png │ │ └── xmldoc.gif │ │ ├── note.txt │ │ ├── site-to-xhtml.xsl │ │ ├── skinconf.xsl │ │ ├── tab-to-menu.xsl │ │ └── xslt │ │ ├── fo │ │ └── document-to-fo.xsl │ │ └── html │ │ ├── book-to-menu.xsl │ │ ├── document-to-html.xsl │ │ ├── site-to-xhtml.xsl │ │ └── tab-to-menu.xsl │ └── translations │ ├── langcode.xml │ ├── languages_en.xml │ ├── menu.xml │ ├── menu_de.xml │ └── tabs.xml ├── log4js-solr ├── README.md └── schema.xml └── log4js ├── .babelrc ├── .eslintrc ├── .jshintrc ├── Gruntfile.js ├── README.md ├── nbproject ├── project.properties └── project.xml ├── package-lock.json ├── package.json ├── src ├── main │ ├── example │ │ └── index.html │ ├── js │ │ ├── appender.js │ │ ├── appenders │ │ │ ├── ajax.js │ │ │ ├── browser-console.js │ │ │ ├── console.js │ │ │ ├── js-alert.js │ │ │ ├── metatag.js │ │ │ └── windows-event.js │ │ ├── custom-event.js │ │ ├── date-formatter.js │ │ ├── fifo-buffer.js │ │ ├── layout.js │ │ ├── layouts │ │ │ ├── basic.js │ │ │ ├── html.js │ │ │ ├── json.js │ │ │ ├── pattern.js │ │ │ ├── simple.js │ │ │ └── xml.js │ │ ├── level.js │ │ ├── log4js-all.js │ │ ├── log4js.js │ │ ├── logger.js │ │ └── logging-event.js │ └── resources │ │ ├── log4js.dtd │ │ └── log4js.xsd └── test │ ├── js │ └── unit │ │ ├── appenders │ │ ├── ajax.js │ │ └── console.js │ │ ├── formatters │ │ └── date.js │ │ ├── layouts │ │ ├── basic.js │ │ ├── json.js │ │ ├── pattern.js │ │ └── xml.js │ │ └── logger.js │ ├── karma.conf.js │ └── resources │ ├── log4js-event-test.xml │ └── log4js-response-test.xml └── tasks └── karma.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # EditorConfig is awesome: http://EditorConfig.org 3 | 4 | root = true 5 | 6 | [*.java] 7 | indent_style = space 8 | indent_size = 3 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.{js,css}] 15 | indent_style = tab 16 | end_of_line = lf 17 | charset = utf-8 18 | trim_trailing_whitespace = true 19 | insert_final_newline = true 20 | 21 | [*.jsp] 22 | charset = utf-8 23 | indent_style = space 24 | indent_size = 3 25 | end_of_line = lf 26 | insert_final_newline = true 27 | trim_trailing_whitespace = true 28 | 29 | [*.json] 30 | indent_style = space 31 | indent_size = 2 32 | 33 | [*.md] 34 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | name: "CodeQL" 7 | 8 | on: 9 | push: 10 | branches: [master] 11 | pull_request: 12 | # The branches below must be a subset of the branches above 13 | branches: [master] 14 | schedule: 15 | - cron: '0 21 * * 5' 16 | 17 | jobs: 18 | analyze: 19 | name: Analyze 20 | runs-on: ubuntu-latest 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | # Override automatic language detection by changing the below list 26 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] 27 | language: ['javascript', 'java'] 28 | # Learn more... 29 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection 30 | 31 | steps: 32 | - name: Checkout repository 33 | uses: actions/checkout@v2 34 | with: 35 | # We must fetch at least the immediate parents so that if this is 36 | # a pull request then we can checkout the head. 37 | fetch-depth: 2 38 | 39 | # If this run was triggered by a pull request event, then checkout 40 | # the head of the pull request instead of the merge commit. 41 | - run: git checkout HEAD^2 42 | if: ${{ github.event_name == 'pull_request' }} 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /nbproject/private/ 2 | node_modules/ 3 | release/ 4 | build/ 5 | log4js/target/ 6 | log4js/node_modules/ 7 | log4js-servlet/target/ 8 | log4js-servlet/lib/ 9 | log4js-site/build/ 10 | /log4js-servlet/nbproject/private/ 11 | /log4js-servlet/nbproject/ 12 | /log4js/nbproject/private/ 13 | log4js/.cache/ 14 | log4js-servlet/out/ 15 | .idea/ 16 | .gradle/ 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | cache: 3 | bundler: true 4 | directories: 5 | - node_modules 6 | node_js: 7 | - 10.6.0 8 | env: 9 | - CXX=g++-4.8 10 | addons: 11 | apt: 12 | sources: 13 | - ubuntu-toolchain-r-test 14 | packages: 15 | - g++-4.8 16 | before_install: 17 | - export DISPLAY=:99.0 18 | - sh -e /etc/init.d/xvfb start 19 | - gem update --system 20 | install: 21 | - cd log4js 22 | - npm ci 23 | before_script: 24 | - npm ci 25 | script: 26 | - grunt --gruntfile "Gruntfile.js" build 27 | deploy: 28 | - provider: npm 29 | email: stephan@st-strittmatter.name 30 | api_key: 31 | secure: NQyGsxZKqApzTxBjsXMI/2drQcCF8s38iuofEL/wbATWC9Y9ggfI6oyd/tqqyYrgouBoSqHPSOEP4ghe381yrO9jlnJMiwzmLqVivZAAe4x2DI3nrlaz+AFcvTpf/36T4LFevTP3Lh6LoVGRrKnfRCjQzfBv0hYOLtjNCc/zjeU= 32 | file_glob: true 33 | file: target/*.zip 34 | skip_cleanup: true 35 | on: 36 | tags: true 37 | repo: stritti/log4js 38 | - provider: releases 39 | api_key: 40 | secure: iKdorqXgiTH3RcLLNj8Q4AoRWxpYA6yT7YDYKnuORz3tcAvHrIBmt+ff6h5zsn2JVGkFamc0njfYdrOfLdc4+cQQfQVq80OhJJnkIQ0WgOtG0yt+yVHKb8lWBGr9P0lMvvBuROsuxGl9jPcgkUTtuvxHoJ3T24WlLDGXJSWdCzw= 41 | file_glob: true 42 | file: target/*.zip 43 | skip_cleanup: true 44 | on: 45 | repo: stritti/log4js 46 | tags: true -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Apache License](http://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat)](LICENSE.txt) 2 | [![Github Releases](https://img.shields.io/github/downloads/atom/atom/latest/total.svg)](https://github.com/stritti/log4js/releases) 3 | [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) 4 | [![Build Status](https://secure.travis-ci.org/stritti/log4js.png?branch=master)](http://travis-ci.org/stritti/log4js) 5 | 6 | Log4js 7 | ====== 8 | 9 | Log4js - The Logging Framework for JavaScript with no runtime dependencies 10 | | Since [2005](https://github.com/stritti/log4js/commit/0b17184d2a998f6ff884261ba433c3e4f01cc95e) 11 | 12 | ## Usage 13 | 14 | * Download the most current [release](https://github.com/stritti/log4js/releases) and unzip the archive. 15 | * Copy the file `js/log4js.min.js` to your project. 16 | * Add the JavaScript file to head of HTML page: 17 | ````html 18 | 19 | 20 | 21 | 22 | ```` 23 | * Add script for instantiation of Logger: 24 | ````javascript 25 | let consoleLog = new Log4js.Logger("consoleTest"); 26 | consoleLog.setLevel(Log4js.Level.ALL); 27 | let consoleAppender = new Log4js.ConsoleAppender(true); 28 | consoleLog.addAppender(consoleAppender); 29 | 30 | ```` 31 | * Then you are able to add logging event: 32 | ````javascript 33 | consoleLog.trace('I was traced!') 34 | ```` 35 | 36 | Within sources there is a more detailed [example](log4js/src/main/example/index.html). 37 | 38 | ## Development 39 | 40 | The project is seperated in modules. Core JavaScript module is located in subdirectory `log4js` 41 | 42 | ### Structure 43 | ```` 44 | ├───log4js: Main JavaScript Log4js module 45 | ├───log4js-servlet: Java Servlet to collect AJAX-Logs serverside 46 | ├───log4js-solr: configuration to collect logs using Apache SOLR 47 | ├───log4js-site: (outdated) project documentation 48 | 49 | ```` 50 | 51 | ### Log4js 52 | > Main JavaScript module 53 | 54 | To build the JavaScript library we use [npm](https://www.npmjs.com/) and [grunt](https://gruntjs.com/). 55 | 56 | ```` 57 | cd log4js 58 | npm install 59 | grunt build 60 | ```` 61 | 62 | Include then the `target/log4js.min.js` file in your project. 63 | 64 | More details in the [Wiki](https://github.com/stritti/log4js/wiki/Development) 65 | 66 | ### Log4js Servlet 67 | 68 | The servlet is Java based project which is compiled using `maven`. 69 | 70 | ### Log4js SOLR 71 | 72 | For more details see [README.md](log4js-solr/README.md) in the subdirectory [log4js-solr](log4js-solr) 73 | 74 | ### Log4js Site 75 | 76 | Outdated documentation. 77 | 78 | ## Contribution 79 | 80 | [Pull Requests](https://github.com/stritti/log4js/pulls) are very welcome. 81 | 82 | ## Other JavaScript Logger 83 | There are a lot other projects which are started logging in JavaScript: 84 | 85 | There is a very active fork of current log4js framework modified for node.js usage: https://github.com/nomiddlename/log4js-node 86 | 87 | Further loggers could be found (and added!) in the [Wiki](https://github.com/stritti/log4js/wiki/Other-JavaScript-Logger). 88 | 89 | # License 90 | [LICENSE.txt](LICENSE.txt) 91 | 92 | [![Analytics](https://ga-beacon.appspot.com/UA-327996-12/stritti/log4js)](https://github.com/igrigorik/ga-beacon) 93 | -------------------------------------------------------------------------------- /log4js-servlet/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | 3 | apply plugin: 'java' 4 | apply plugin: 'war' 5 | apply plugin: 'jacoco' 6 | apply plugin: 'eclipse' 7 | apply plugin: 'idea' 8 | 9 | group = 'de.log4js' 10 | version = '2.0.0Beta1' 11 | sourceCompatibility = 1.8 12 | 13 | repositories { 14 | mavenCentral() 15 | } 16 | 17 | 18 | dependencies { 19 | 20 | compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' 21 | compile group: 'commons-io', name: 'commons-io', version: '2.6' 22 | compile group: 'com.google.code.gson', name: 'gson', version: '2.7' 23 | compile group: 'javax.servlet', name: 'servlet-api', version: '2.5' 24 | compile group: 'javax.servlet.jsp', name: 'jsp-api', version: '2.1' 25 | 26 | testCompile group: 'junit', name: 'junit', version: '4.12' 27 | 28 | } 29 | 30 | compileJava { 31 | options.encoding = 'UTF-8' 32 | options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" 33 | } 34 | -------------------------------------------------------------------------------- /log4js-servlet/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-servlet/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /log4js-servlet/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 24 15:52:08 CEST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip 7 | -------------------------------------------------------------------------------- /log4js-servlet/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /log4js-servlet/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'log4js' 2 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/LogLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js; 15 | 16 | /** 17 | * The LogLevels of Log4js 18 | * 19 | * @author Stephan Strittmatter 20 | * @created 02.08.2007 21 | * 22 | * @history 02.08.2007 Stephan Strittmatter created 23 | */ 24 | public enum LogLevel { 25 | 26 | DEBUG, INFO, WARN, ERROR, FATAL, TRACE; 27 | 28 | public static LogLevel getLogLevel(String attribute) { 29 | 30 | if ("DEBUG".equals(attribute)) { 31 | return LogLevel.DEBUG; 32 | } 33 | else if ("INFO".equals(attribute)) { 34 | return LogLevel.INFO; 35 | } 36 | else if ("WARN".equals(attribute)) { 37 | return LogLevel.WARN; 38 | } 39 | else if ("ERROR".equals(attribute)) { 40 | return LogLevel.ERROR; 41 | } 42 | else if ("FATAL".equals(attribute)) { 43 | return LogLevel.FATAL; 44 | } 45 | else if ("TRACE".equals(attribute)) { 46 | return LogLevel.TRACE; 47 | } 48 | 49 | return null; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/adapter/Adapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.adapter; 15 | 16 | import de.log4js.LoggingEvent; 17 | 18 | /** 19 | * Interface to adapt the Log4js events to specific Logging 20 | * implementation. 21 | * 22 | * @author Stephan Strittmatter 23 | * @created 02.08.2007 24 | */ 25 | public interface Adapter { 26 | 27 | /** 28 | * Log the given Log4js Event to the specific logger. 29 | * 30 | * @param event Event send by Log4js 31 | */ 32 | void logEvent(LoggingEvent event); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/adapter/JavaLoggingAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.adapter; 15 | 16 | import de.log4js.LoggingEvent; 17 | 18 | import java.util.logging.Level; 19 | import java.util.logging.Logger; 20 | 21 | /** 22 | * Adapter to log using Java logging. 23 | * 24 | * TODO log also userAgent 25 | * 26 | * @author Stephan Strittmatter 27 | * @created 02.08.2007 28 | */ 29 | public class JavaLoggingAdapter implements Adapter { 30 | 31 | /** 32 | * @see de.berlios.log4js.adapter.Adapter#logEvent(de.berlios.log4js.LoggingEvent) 33 | */ 34 | public void logEvent(LoggingEvent loggingEvent) { 35 | 36 | String msg; 37 | 38 | Logger logger = Logger.getLogger(loggingEvent.getCategoryName()); 39 | 40 | if (loggingEvent.getException() != null) { 41 | msg = loggingEvent.getMessage() + " -- EXCEPTION:\t" 42 | + loggingEvent.getException(); 43 | } else { 44 | msg = loggingEvent.getMessage(); 45 | } 46 | 47 | switch (loggingEvent.getLogLevel()) { 48 | case ERROR: 49 | logger.log(Level.SEVERE, msg); 50 | break; 51 | 52 | case DEBUG: 53 | logger.log(Level.FINER, msg); 54 | break; 55 | 56 | case FATAL: 57 | logger.log(Level.SEVERE, msg); 58 | break; 59 | 60 | case INFO: 61 | logger.log(Level.FINE, msg); 62 | break; 63 | 64 | case TRACE: 65 | logger.log(Level.FINEST, msg); 66 | break; 67 | 68 | case WARN: 69 | logger.log(Level.WARNING, msg); 70 | break; 71 | 72 | default: 73 | throw new IllegalArgumentException(loggingEvent.getLogLevel() 74 | + " not supported"); 75 | } 76 | 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/adapter/Log4jAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | /* 15 | * Licensed under the Apache License, Version 2.0 (the "License"); 16 | * you may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at 18 | * 19 | * http://www.apache.org/licenses/LICENSE-2.0 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | */ 27 | package de.log4js.adapter; 28 | 29 | 30 | import de.log4js.LoggingEvent; 31 | import org.slf4j.Logger; 32 | import org.slf4j.LoggerFactory; 33 | 34 | 35 | /** 36 | * Adapter to log using Apache Log4j logging. 37 | * 38 | * @author Stephan Strittmatter 39 | * @created 02.08.2007 40 | */ 41 | public class Log4jAdapter implements Adapter { 42 | 43 | private Logger logger; 44 | 45 | /** 46 | * @see de.log4js.adapter.Adapter#logEvent(de.log4js.LoggingEvent) 47 | */ 48 | public void logEvent(LoggingEvent loggingEvent) { 49 | 50 | String msg; 51 | 52 | this.logger = LoggerFactory.getLogger(loggingEvent.getCategoryName()); 53 | 54 | if (loggingEvent.getException() != null) { 55 | msg = loggingEvent.getMessage() + " -- EXCEPTION:\t" 56 | + loggingEvent.getException(); 57 | } else { 58 | msg = loggingEvent.getMessage(); 59 | } 60 | 61 | switch (loggingEvent.getLogLevel()) { 62 | case ERROR: 63 | this.logger.error( msg); 64 | break; 65 | 66 | case DEBUG: 67 | this.logger.debug( msg); 68 | break; 69 | 70 | case FATAL: 71 | this.logger.error( msg); 72 | break; 73 | 74 | case INFO: 75 | this.logger.info( msg); 76 | break; 77 | 78 | case TRACE: 79 | this.logger.trace( msg); 80 | break; 81 | 82 | case WARN: 83 | this.logger.warn(msg); 84 | break; 85 | 86 | default: 87 | throw new IllegalArgumentException(loggingEvent.getLogLevel() 88 | + " not supported"); 89 | } 90 | 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/parser/EventParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.parser; 15 | 16 | import de.log4js.LoggingEvent; 17 | 18 | import java.io.InputStream; 19 | import java.util.List; 20 | 21 | /** 22 | * Interface of event parser. 23 | * 24 | * @author Stephan Strittmatter 25 | * 26 | */ 27 | public interface EventParser { 28 | 29 | /** 30 | * Parses the given String for XML to extract the parameter and assign them 31 | * to the members. 32 | * 33 | * @param xml 34 | * XML-Content 35 | * @return List of logging events 36 | * @throws ParseException 37 | * if fails to parse 38 | */ 39 | List parse(String xml) throws ParseException; 40 | 41 | /** 42 | * Parses the given input stream for XML to extract the parameter and assign 43 | * them to the members. 44 | * 45 | * @param is 46 | * XML Content 47 | * @return List of logging events 48 | * @throws ParseException 49 | * if fails to parse 50 | */ 51 | List parse(InputStream is) throws ParseException; 52 | 53 | /** 54 | * Get header of the event list. 55 | * 56 | * @return the header 57 | */ 58 | String getResponseHeader(); 59 | 60 | /** 61 | * Get the response for given events back to log4js. 62 | * 63 | * @param state 64 | * state of logging. 65 | * @param message 66 | * possible error message 67 | * @param throwable 68 | * possible exception 69 | * @return the message for response. 70 | */ 71 | String getResponse(String state, String message, Throwable throwable); 72 | 73 | } -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/parser/JsonEventParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.parser; 15 | 16 | import com.google.gson.Gson; 17 | import com.google.gson.JsonObject; 18 | import de.log4js.LoggingEvent; 19 | 20 | import java.io.IOException; 21 | import java.io.InputStream; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | /** 26 | * Parser to parse JSON of log4js events. 27 | * 28 | * @author Stephan Strittmatter 29 | * @created 02.08.2007 30 | * 31 | * @history 02.08.2007 Stephan Strittmatter created 32 | */ 33 | public class JsonEventParser implements EventParser { 34 | 35 | private Gson gson = new Gson(); 36 | 37 | /** 38 | * @see de.log4js.parser.EventParser#parse(java.lang.String) 39 | */ 40 | @SuppressWarnings("unchecked") 41 | public List parse(String input) throws ParseException { 42 | 43 | List eventList = new ArrayList(); 44 | 45 | LoggingEvent json = gson.fromJson(input, LoggingEvent.class); 46 | 47 | return eventList; 48 | } 49 | 50 | /** 51 | * @see de.log4js.parser.EventParser#parse(java.io.InputStream) 52 | */ 53 | public List parse(InputStream is) throws ParseException { 54 | 55 | List result; 56 | try { 57 | result = parse(inputStreamToString(is)); 58 | } catch (IOException e) { 59 | throw new ParseException(e); 60 | } 61 | 62 | return result; 63 | } 64 | 65 | protected static String inputStreamToString(InputStream in) 66 | throws IOException { 67 | 68 | StringBuilder out = new StringBuilder(); 69 | byte[] b = new byte[4096]; 70 | for (int n; (n = in.read(b)) != -1;) { 71 | out.append(new String(b, 0, n)); 72 | } 73 | return out.toString(); 74 | } 75 | 76 | public String getResponseHeader() { 77 | return null; 78 | } 79 | 80 | public String getResponse(String state, String message, Throwable throwable) { 81 | 82 | JsonObject json = new JsonObject(); 83 | json.addProperty("state", state); 84 | json.addProperty("response", message); 85 | 86 | if(throwable != null) { 87 | json.addProperty("stacktrace", "" + throwable.getStackTrace()); 88 | } 89 | return json.toString(); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/java/de/log4js/parser/ParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.parser; 15 | 16 | public class ParseException extends Exception { 17 | 18 | /** 19 | * 20 | */ 21 | private static final long serialVersionUID = 7390689607047694643L; 22 | 23 | public ParseException() { 24 | super(); 25 | } 26 | 27 | public ParseException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public ParseException(String message) { 32 | super(message); 33 | } 34 | 35 | public ParseException(Throwable cause) { 36 | super(cause); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=ERROR, F1 2 | log4j.appender.F1=org.apache.log4j.FileAppender 3 | log4j.appender.F1.File=${catalina.base}/log/rocket.log 4 | log4j.appender.F1.ImmediateFlush=true 5 | log4j.appender.F1.layout=org.apache.log4j.PatternLayout 6 | 7 | # Print the date in ISO 8601 format 8 | log4j.appender.F1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n 9 | 10 | log4j.logger.org.apache=INFO 11 | 12 | rocket=TRACE 13 | 14 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 23 | 24 | Log4js 25 | Log4js servlet to log JavaScript logging events on server side. 26 | 27 | 28 | Log4js Servlet 29 | de.log4js.Log4jsServlet 30 | 31 | 32 | 33 | Adapter which adapts the specific logging implementation like Java logging or Log4j. 34 | This adapter has to implement the interface de.berlios.log4js.adapter.Adapter. 35 | E.g.: de.berlios.log4js.adapter.JavaLoggingAdapter, 36 | de.berlios.log4js.adapter.Log4jAdapter 37 | 38 | logging.adapter 39 | de.log4js.adapter.Log4jAdapter 40 | 41 | 42 | 43 | Parser implementation for XML data. 44 | parser.text/xml 45 | de.log4js.parser.XmlEventParser 46 | 47 | 48 | 49 | Parser implementation for JSON data. 50 | parser.text/json 51 | de.log4js.parser.JsonEventParser 52 | 53 | 54 | 55 | 56 | CorsFilter 57 | org.apache.catalina.filters.CorsFilter 58 | 59 | cors.allowed.origins 60 | * 61 | 62 | 63 | cors.exposed.headers 64 | Access-Control-Allow-Origin 65 | 66 | 67 | 68 | CorsFilter 69 | /* 70 | 71 | 72 | 73 | Log4js Servlet 74 | /log4js/* 75 | 76 | 77 | 78 | Log4js Servlet 79 | /log4js 80 | 81 | 82 | 83 | Log4js Servlet 84 | *.log4js 85 | 86 | 87 | 88 | index.html 89 | index.jsp 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /log4js-servlet/src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Hello World!

4 | dear Log4js. 5 | 6 | 7 | -------------------------------------------------------------------------------- /log4js-servlet/src/test/java/de/log4js/Log4jsServletTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js; 15 | 16 | import org.junit.After; 17 | import org.junit.Before; 18 | import org.junit.Test; 19 | 20 | import javax.servlet.ServletException; 21 | import java.io.IOException; 22 | 23 | public class Log4jsServletTest { 24 | 25 | Log4jsServlet servlet; 26 | 27 | @Before 28 | public void setUp() throws Exception { 29 | 30 | servlet = new Log4jsServlet(); 31 | } 32 | 33 | @After 34 | public void tearDown() throws Exception { 35 | 36 | } 37 | 38 | @Test 39 | public void testDoGet() throws ServletException, IOException { 40 | 41 | servlet.doGet(null, null); 42 | } 43 | 44 | @Test 45 | public void testDoPost() throws ServletException, IOException { 46 | 47 | servlet.doPost(null, null); 48 | } 49 | 50 | @Test 51 | public void testGetAdapter() { 52 | 53 | } 54 | 55 | @Test 56 | public void testGetParser() { 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /log4js-servlet/src/test/java/de/log4js/TestUtil.java: -------------------------------------------------------------------------------- 1 | package de.log4js; 2 | 3 | import java.io.FileInputStream; 4 | 5 | public class TestUtil { 6 | 7 | /** 8 | * Converts a file specified by the path, to the String. 9 | */ 10 | public static String fileToString(String fileName) { 11 | if (fileName != null) { 12 | // String sLine; 13 | byte[] utf8Bytes; 14 | String sFile = new String(); 15 | // Reading input by lines: 16 | try { 17 | FileInputStream fis = new FileInputStream(fileName); 18 | int noOfBytes = fis.available(); 19 | if (noOfBytes > 0) { 20 | utf8Bytes = new byte[noOfBytes]; 21 | fis.read(utf8Bytes); 22 | sFile = new String(utf8Bytes, "UTF8"); 23 | } 24 | } catch (Exception ex) { 25 | return null; 26 | } 27 | return sFile; 28 | } 29 | return null; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /log4js-servlet/src/test/java/de/log4js/adapter/JavaLoggingAdapterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.adapter; 15 | 16 | import org.junit.Test; 17 | 18 | import static org.junit.Assert.fail; 19 | 20 | public class JavaLoggingAdapterTest { 21 | 22 | @Test 23 | public void testLogEvent() { 24 | fail("Not yet implemented"); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /log4js-servlet/src/test/java/de/log4js/adapter/Log4jAdapterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.adapter; 15 | 16 | import org.junit.Test; 17 | 18 | import static org.junit.Assert.fail; 19 | 20 | public class Log4jAdapterTest { 21 | 22 | @Test 23 | public void testLogEvent() { 24 | fail("Not yet implemented"); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /log4js-servlet/src/test/java/de/log4js/parser/JsonEventParserTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.parser; 15 | 16 | 17 | import de.log4js.LogLevel; 18 | import de.log4js.LoggingEvent; 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | import java.util.List; 23 | 24 | public class JsonEventParserTest { 25 | 26 | @Test 27 | public void testParseString() throws ParseException { 28 | String jsonString = "{\"Log4js\": [\n"; 29 | jsonString += "{\n \"LoggingEvent\": {\n"; 30 | jsonString += "\t\"logger\": \"" + "category1" + "\",\n"; 31 | jsonString += "\t\"level\": \"" + "ERROR" + "\",\n"; 32 | jsonString += "\t\"message\": \"" + "My message" + "\",\n"; 33 | jsonString += "\t\"referer\": \"" + "http://stritti.github.io/log4js/" + "\",\n"; 34 | jsonString += "\t\"useragent\": \"" + "Mozilla" + "\",\n"; 35 | jsonString += "\t\"timestamp\": \"" + "2000-02-01T12:13:30Z" + "\",\n"; 36 | jsonString += "\t\"exception\": \"" + "exception1" + "\"\n"; 37 | jsonString += "}},"; 38 | 39 | jsonString += "{\n \"LoggingEvent\": {\n"; 40 | jsonString += "\t\"logger\": \"" + "category2" + "\",\n"; 41 | jsonString += "\t\"level\": \"" + "INFO" + "\",\n"; 42 | jsonString += "\t\"message\": \"" + "My message" + "\",\n"; 43 | jsonString += "\t\"referer\": \"" + "http://stritti.github.io/log4js/" + "\",\n"; 44 | jsonString += "\t\"useragent\": \"" + "Mozilla" + "\",\n"; 45 | jsonString += "\t\"timestamp\": \"" + "2000-02-01T12:13:30Z" + "\",\n"; 46 | jsonString += "\t\"exception\": \"" + "exception2" + "\"\n"; 47 | jsonString += "}}"; 48 | jsonString += "\n]}"; 49 | 50 | EventParser parser = new JsonEventParser(); 51 | 52 | List actual = parser.parse(jsonString); 53 | Assert.assertEquals(2, actual.size()); 54 | 55 | LoggingEvent loggingEvent = actual.get(0); 56 | Assert.assertEquals("category1", loggingEvent.getCategoryName()); 57 | 58 | Assert.assertEquals("exception1", loggingEvent.getException()); 59 | Assert.assertEquals(LogLevel.ERROR, loggingEvent.getLogLevel()); 60 | 61 | loggingEvent = actual.get(1); 62 | Assert.assertEquals("category2", loggingEvent.getCategoryName()); 63 | 64 | Assert.assertEquals("exception2", loggingEvent.getException()); 65 | Assert.assertEquals(LogLevel.INFO, loggingEvent.getLogLevel()); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /log4js-servlet/src/test/java/de/log4js/parser/XmlEventParserTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package de.log4js.parser; 15 | 16 | import de.log4js.LogLevel; 17 | import de.log4js.LoggingEvent; 18 | import de.log4js.TestUtil; 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | import java.util.List; 23 | 24 | public class XmlEventParserTest { 25 | 26 | 27 | @Test 28 | public void testParse() throws ParseException { 29 | 30 | String content = TestUtil.fileToString("src/test/resources/log4js-event-test.xml"); 31 | EventParser parser = new XmlEventParser(); 32 | 33 | List actual = parser.parse(content); 34 | Assert.assertEquals(3, actual.size()); 35 | 36 | LoggingEvent loggingEvent = actual.get(0); 37 | Assert.assertEquals("ajaxTest", loggingEvent.getCategoryName()); 38 | Assert.assertEquals(LogLevel.TRACE, loggingEvent.getLogLevel()); 39 | Assert.assertEquals("Exception", loggingEvent.getException()); 40 | 41 | 42 | 43 | loggingEvent = actual.get(1); 44 | Assert.assertEquals("ajaxTest", loggingEvent.getCategoryName()); 45 | Assert.assertEquals(LogLevel.DEBUG, loggingEvent.getLogLevel()); 46 | Assert.assertEquals("I was debuged!", loggingEvent.getMessage()); 47 | 48 | 49 | Assert.assertEquals(LogLevel.INFO, loggingEvent.getLogLevel()); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /log4js-site/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | log4js-site 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /log4js-site/forrest.properties: -------------------------------------------------------------------------------- 1 | forrest.validate=false 2 | forrest.maxmemory=128m 3 | project.bugtracking-url=https\://github.com/stritti/log4js/issues 4 | project.content-dir=xdocs 5 | project.debuglevel=WARN 6 | project.issues-rss-url= 7 | project.name=Log4js 8 | project.required.plugins=org.apache.forrest.plugin.input.dtdx,org.apache.forrest.plugin.input.projectInfo,org.apache.forrest.plugin.output.pdf,org.apache.forrest.plugin.input.feeder 9 | project.skin=pelt 10 | project.start-uri=linkmap.html 11 | project.status=status.xml 12 | 13 | 14 | # Switch to generate a Google Sitemap file 15 | project.generate-google-sitemap=false 16 | 17 | # Name of the Google Sitemap file 18 | project.google-sitemap-name=sitemap.xml 19 | 20 | # Prefix to generate absolute urls in Google Sitemap file 21 | #project.site-uri-prefix=http://localhost/ 22 | -------------------------------------------------------------------------------- /log4js-site/forrest.properties.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /log4js-site/logo/1.0/1.0.collors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/1.0.collors.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/1.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/1.0.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/1.0_70px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/1.0_70px.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/1.0_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/1.0_favicon.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/dot_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/dot_blue.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/dot_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/dot_grey.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/dot_lightblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/dot_lightblue.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/dot_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/dot_orange.png -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/1.0.collors.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/1.0.collors.jpg -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/1.0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/1.0.jpg -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/1.0_70px.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/1.0_70px.jpg -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/dot_blue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/dot_blue.gif -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/dot_grey.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/dot_grey.gif -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/dot_lightblue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/dot_lightblue.gif -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/dot_orange.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/dot_orange.gif -------------------------------------------------------------------------------- /log4js-site/logo/1.0/exports/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/logo/1.0/exports/favicon.ico -------------------------------------------------------------------------------- /log4js-site/xdocs/README.txt: -------------------------------------------------------------------------------- 1 | This is the base documentation directory. 2 | 3 | skinconf.xml # This file customizes Forrest for your project. In it, you 4 | # tell forrest the project name, logo, copyright info, etc 5 | 6 | sitemap.xmap # Optional. This sitemap is consulted before all core sitemaps. 7 | # See http://forrest.apache.org/docs/project-sitemap.html 8 | -------------------------------------------------------------------------------- /log4js-site/xdocs/classes/CatalogManager.properties: -------------------------------------------------------------------------------- 1 | # Copyright 2002-2005 The Apache Software Foundation or its licensors, 2 | # as applicable. 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 | #======================================================================= 17 | # CatalogManager.properties for Catalog Entity Resolver. 18 | # 19 | # This is the default properties file for your project. 20 | # This facilitates local configuration of application-specific catalogs. 21 | # If you have defined any local catalogs, then they will be loaded 22 | # before Forrest's core catalogs. 23 | # 24 | # See the Apache Forrest documentation: 25 | # http://forrest.apache.org/docs/your-project.html 26 | # http://forrest.apache.org/docs/validation.html 27 | 28 | # verbosity: 29 | # The level of messages for status/debug (messages go to standard output). 30 | # The setting here is for your own local catalogs. 31 | # The verbosity of Forrest's core catalogs is controlled via 32 | # main/webapp/WEB-INF/cocoon.xconf 33 | # 34 | # The following messages are provided ... 35 | # 0 = none 36 | # 1 = ? (... not sure yet) 37 | # 2 = 1+, Loading catalog, Resolved public, Resolved system 38 | # 3 = 2+, Catalog does not exist, resolvePublic, resolveSystem 39 | # 10 = 3+, List all catalog entries when loading a catalog 40 | # (Cocoon also logs the "Resolved public" messages.) 41 | verbosity=1 42 | 43 | # catalogs ... list of additional catalogs to load 44 | # (Note that Apache Forrest will automatically load its own default catalog 45 | # from main/webapp/resources/schema/catalog.xcat) 46 | # Use either full pathnames or relative pathnames. 47 | # pathname separator is always semi-colon (;) regardless of operating system 48 | # directory separator is always slash (/) regardless of operating system 49 | catalogs=../resources/schema/catalog.xcat 50 | 51 | # relative-catalogs 52 | # If false, relative catalog URIs are made absolute with respect to the 53 | # base URI of the CatalogManager.properties file. This setting only 54 | # applies to catalog URIs obtained from the catalogs property in the 55 | # CatalogManager.properties file 56 | # Example: relative-catalogs=[yes|no] 57 | relative-catalogs=no 58 | -------------------------------------------------------------------------------- /log4js-site/xdocs/content/doap.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 24 | 25 | Log4js 26 | 27 | Log4js 28 | http://stritti.github.io/log4js/ 29 | 30 | 31 | 2005-08-09T23:06:00Z 32 | tag:apache.org:forrest 33 | 34 | 39 | 40 | 41 | Log4js 42 | tag:log4js:0.7 43 | 2005-08-09T23:06:00Z 44 | 45 | 46 | 47 | Log4js 48 | 49 | 2005-06-23 50 | 51 | 52 | Log4js is a logging API for JavaScript. The main goal is to have 53 | a robust and solid logging API which is very simmilar to the 54 | Java logging API Log4j. 55 | 56 | 57 | JavaScript 58 | XML 59 | 60 | 61 | 62 | 64 | 65 | 67 | 68 | 69 | 70 | The Log4js Project 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 0.2 79 | unreleased 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/architecture.aart: -------------------------------------------------------------------------------- 1 | +-------------------+ 2 | | Logger | 3 | +-------------------+ 4 | | * getLogger() | 5 | | * addAppender() | 6 | | * fatal() | 7 | | * error() | 8 | | * ... | 9 | +--------+----------+ 10 | | 11 | | 12 | +--------+----------+ +------------+ 13 | | Appender | | Layout | 14 | +-------------------+ +------------+ 15 | | * doAppend() +----+ * format() | 16 | | * doClear() | | | 17 | | * setLayout() | | | 18 | +-------------------+ +------------+ -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/committer.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 |
22 | Log4js - Comitter 23 | 24 | 25 | 26 | ALL 27 | Log4js - Committer 28 | log4js, logging, javascript, committer 29 |
30 | 31 | 32 |
33 | Community 34 |

Eyerybody is welcome to support Log4js. Do not hesitate to contact us.

35 |
36 | Active Committers 37 |
    38 |
  • 39 | [ssr] - Stephan Strittmatter [Blog] 40 |
  • 41 |
  • 42 | [sce] - Seth Chisamore 43 |
  • 44 |
45 |
46 |
47 | 48 |
-------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/credits.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 |
22 | Log4js - Credits 23 | 24 | 25 | 26 | ALL 27 | Log4js - Credits 28 | log4js, logging, javascript, credits 29 | 30 |
31 | 32 | 33 |
34 | Credits 35 | 36 |

Special thanks to all who helped to improve log4js. Here a list of 37 | people supported us:

38 | 52 |
53 | 54 |
-------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/docu/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 |
22 | Log4js - Documentation 23 | 24 | 25 | 26 | 27 | ALL 28 | Log4js - Documentation of the Logging API 29 | log4js, logging, javascript, ajax, documentation 30 | 31 |
32 | 33 | 34 | 35 |

Find the documentation of Log4js here:

36 |
    37 |
  1. Users Guide
  2. 38 |
  3. Frequently Asked Questions
  4. 39 |
  5. WIKI
  6. 40 |
  7. API-Documentation (JSDoc)
  8. 41 |
42 | 43 | 44 |
-------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/content/xdocs/favicon.ico -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/images/group-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/content/xdocs/images/group-logo.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/images/group.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 26 | 27 | 36 | 42 | Anteater logo 43 | 44 | 45 | 46 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/content/xdocs/images/icon.png -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/images/project-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/content/xdocs/images/project-logo.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/images/project.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 26 | 27 | 36 | 42 | Anteater logo 43 | 44 | 45 | 46 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/images/usemap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/content/xdocs/images/usemap.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: -------------------------------------------------------------------------------- /log4js-site/xdocs/content/xdocs/tabs.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 22 | 32 | 33 | 34 | 35 | 36 | 42 | 43 | 44 | 45 | 46 | 50 | -------------------------------------------------------------------------------- /log4js-site/xdocs/locationmap.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/images/Log4JS-UML.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/resources/images/Log4JS-UML.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/images/project-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/resources/images/project-logo.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/images/project-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/resources/images/project-logo.png -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/images/users-guide/consoleExample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/resources/images/users-guide/consoleExample.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/js/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | dp.sh.Brushes.JScript = function() 2 | { 3 | var keywords = 'abstract boolean break byte case catch char class const continue debugger ' + 4 | 'default delete do double else enum export extends false final finally float ' + 5 | 'for function goto if implements import in instanceof int interface long native ' + 6 | 'new null package private protected public return short static super switch ' + 7 | 'synchronized this throw throws transient true try typeof var void volatile while with'; 8 | 9 | this.regexList = [ 10 | { regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments 11 | { regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments 12 | { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // double quoted strings 13 | { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // single quoted strings 14 | { regex: new RegExp('^\\s*#.*', 'gm'), css: 'preprocessor' }, // preprocessor tags like #region and #endregion 15 | { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keywords 16 | ]; 17 | 18 | this.CssClass = 'dp-c'; 19 | } 20 | 21 | dp.sh.Brushes.JScript.prototype = new dp.sh.Highlighter(); 22 | dp.sh.Brushes.JScript.Aliases = ['js', 'jscript', 'javascript']; 23 | -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/js/shBrushJava.js: -------------------------------------------------------------------------------- 1 | dp.sh.Brushes.Java = function() 2 | { 3 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 4 | 'continue default do double else enum extends ' + 5 | 'false final finally float for goto if implements import ' + 6 | 'instanceof int interface long native new null ' + 7 | 'package private protected public return ' + 8 | 'short static strictfp super switch synchronized this throw throws true ' + 9 | 'transient try void volatile while'; 10 | 11 | this.regexList = [ 12 | { regex: dp.sh.RegexLib.SingleLineCComments, css: 'comment' }, // one line comments 13 | { regex: dp.sh.RegexLib.MultiLineCComments, css: 'comment' }, // multiline comments 14 | { regex: dp.sh.RegexLib.DoubleQuotedString, css: 'string' }, // strings 15 | { regex: dp.sh.RegexLib.SingleQuotedString, css: 'string' }, // strings 16 | { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'number' }, // numbers 17 | { regex: new RegExp('(?!\\@interface\\b)\\@[\\$\\w]+\\b', 'g'), css: 'annotation' }, // annotation @anno 18 | { regex: new RegExp('\\@interface\\b', 'g'), css: 'keyword' }, // @interface keyword 19 | { regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 20 | ]; 21 | 22 | this.CssClass = 'dp-j'; 23 | } 24 | 25 | dp.sh.Brushes.Java.prototype = new dp.sh.Highlighter(); 26 | dp.sh.Brushes.Java.Aliases = ['java']; 27 | -------------------------------------------------------------------------------- /log4js-site/xdocs/resources/js/shBrushXml.js: -------------------------------------------------------------------------------- 1 | dp.sh.Brushes.Xml = function() 2 | { 3 | this.CssClass = 'dp-xml'; 4 | } 5 | 6 | dp.sh.Brushes.Xml.prototype = new dp.sh.Highlighter(); 7 | dp.sh.Brushes.Xml.Aliases = ['xml', 'xhtml', 'xslt', 'html', 'xhtml']; 8 | 9 | dp.sh.Brushes.Xml.prototype.ProcessRegexList = function() 10 | { 11 | function push(array, value) 12 | { 13 | array[array.length] = value; 14 | } 15 | 16 | /* If only there was a way to get index of a group within a match, the whole XML 17 | could be matched with the expression looking something like that: 18 | 19 | () 20 | | () 21 | | (<)*(\w+)*\s*(\w+)\s*=\s*(".*?"|'.*?'|\w+)(/*>)* 22 | | () 23 | */ 24 | var index = 0; 25 | var match = null; 26 | var regex = null; 27 | 28 | // Match CDATA in the following format 29 | // <\!\[[\w\s]*?\[(.|\s)*?\]\]> 30 | this.GetMatches(new RegExp('<\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\]>', 'gm'), 'cdata'); 31 | 32 | // Match comments 33 | // 34 | this.GetMatches(new RegExp('', 'gm'), 'comments'); 35 | 36 | // Match attributes and their values 37 | // (:|\w+)\s*=\s*(".*?"|\'.*?\'|\w+)* 38 | regex = new RegExp('([:\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*', 'gm'); // Thanks to Tomi Blinnikka of Yahoo! for fixing namespaces in attributes 39 | while((match = regex.exec(this.code)) != null) 40 | { 41 | push(this.matches, new dp.sh.Match(match[1], match.index, 'attribute')); 42 | 43 | // if xml is invalid and attribute has no property value, ignore it 44 | if(match[2] != undefined) 45 | { 46 | push(this.matches, new dp.sh.Match(match[2], match.index + match[0].indexOf(match[2]), 'attribute-value')); 47 | } 48 | } 49 | 50 | // Match opening and closing tag brackets 51 | // 52 | this.GetMatches(new RegExp('', 'gm'), 'tag'); 53 | 54 | // Match tag names 55 | // 2 | 18 | 20 | 21 | 22 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /log4js-site/xdocs/sitemap.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/css/forrest.css.xslt: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | /* ==================== aural ============================ */ 38 | 39 | @media aural { 40 | h1, h2, h3, h4, h5, h6 { voice-family: paul, male; stress: 20; richness: 90 } 41 | h1 { pitch: x-low; pitch-range: 90 } 42 | h2 { pitch: x-low; pitch-range: 80 } 43 | h3 { pitch: low; pitch-range: 70 } 44 | h4 { pitch: medium; pitch-range: 60 } 45 | h5 { pitch: medium; pitch-range: 50 } 46 | h6 { pitch: medium; pitch-range: 40 } 47 | li, dt, dd { pitch: medium; richness: 60 } 48 | dt { stress: 80 } 49 | pre, code, tt { pitch: medium; pitch-range: 0; stress: 0; richness: 80 } 50 | em { pitch: medium; pitch-range: 60; stress: 60; richness: 50 } 51 | strong { pitch: medium; pitch-range: 60; stress: 90; richness: 90 } 52 | dfn { pitch: high; pitch-range: 60; stress: 60 } 53 | s, strike { richness: 0 } 54 | i { pitch: medium; pitch-range: 60; stress: 60; richness: 50 } 55 | b { pitch: medium; pitch-range: 60; stress: 90; richness: 90 } 56 | u { richness: 0 } 57 | 58 | :link { voice-family: harry, male } 59 | :visited { voice-family: betty, female } 60 | :active { voice-family: betty, female; pitch-range: 80; pitch: x-high } 61 | } 62 | 63 | 64 | a.external { 65 | padding: 0 20px 0px 0px; 66 | display:inline; 67 | background-repeat: no-repeat; 68 | background-position: center right; 69 | background-image: url(images/external-link.gif); 70 | } 71 | 72 | 73 | /* extra-css */ 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/README.txt: -------------------------------------------------------------------------------- 1 | The images in this directory are used if the current skin lacks them. 2 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/add.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/add.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/built-with-forrest-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/built-with-forrest-button.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/dc.svg.xslt: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/external-link.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/external-link.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/fix.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/fix.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/forrest-credit-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/forrest-credit-logo.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/hack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/hack.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/pdfdoc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/pdfdoc.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/poddoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/poddoc.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/poddoc.svg.xslt: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 49 | POD 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/printer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/printer.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/rc.svg.xslt: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/remove.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/remove.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/rss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/rss.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/spacer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/spacer.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/txtdoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/txtdoc.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/txtdoc.svg.xslt: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 23 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 49 | TXT 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/update.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/update.jpg -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/valid-html401.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/valid-html401.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/vcss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/vcss.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/images/xmldoc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/images/xmldoc.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/scripts/breadcrumbs-optimized.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var PREPREND_CRUMBS=new Array(); 18 | var link1="@skinconfig.trail.link1.name@"; 19 | var link2="@skinconfig.trail.link2.name@"; 20 | var link3="@skinconfig.trail.link3.name@"; 21 | if(!(link1=="")&&!link1.indexOf( "@" ) == 0){ 22 | PREPREND_CRUMBS.push( new Array( link1, @skinconfig.trail.link1.href@ ) ); } 23 | if(!(link2=="")&&!link2.indexOf( "@" ) == 0){ 24 | PREPREND_CRUMBS.push( new Array( link2, @skinconfig.trail.link2.href@ ) ); } 25 | if(!(link3=="")&&!link3.indexOf( "@" ) == 0){ 26 | PREPREND_CRUMBS.push( new Array( link3, @skinconfig.trail.link3.href@ ) ); } 27 | var DISPLAY_SEPARATOR=" > "; 28 | var DISPLAY_PREPREND=" > "; 29 | var DISPLAY_POSTPREND=":"; 30 | var CSS_CLASS_CRUMB="breadcrumb"; 31 | var CSS_CLASS_TRAIL="breadcrumbTrail"; 32 | var CSS_CLASS_SEPARATOR="crumbSeparator"; 33 | var FILE_EXTENSIONS=new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" ); 34 | var PATH_SEPARATOR="/"; 35 | 36 | function sc(s) { 37 | var l=s.toLowerCase(); 38 | return l.substr(0,1).toUpperCase()+l.substr(1); 39 | } 40 | function getdirs() { 41 | var t=document.location.pathname.split(PATH_SEPARATOR); 42 | var lc=t[t.length-1]; 43 | for(var i=0;i < FILE_EXTENSIONS.length;i++) 44 | { 45 | if(lc.indexOf(FILE_EXTENSIONS[i])) 46 | return t.slice(1,t.length-1); } 47 | return t.slice(1,t.length); 48 | } 49 | function getcrumbs( d ) 50 | { 51 | var pre = "/"; 52 | var post = "/"; 53 | var c = new Array(); 54 | if( d != null ) 55 | { 56 | for(var i=0;i < d.length;i++) { 57 | pre+=d[i]+postfix; 58 | c.push(new Array(d[i],pre)); } 59 | } 60 | if(PREPREND_CRUMBS.length > 0 ) 61 | return PREPREND_CRUMBS.concat( c ); 62 | return c; 63 | } 64 | function gettrail( c ) 65 | { 66 | var h=DISPLAY_PREPREND; 67 | for(var i=0;i < c.length;i++) 68 | { 69 | h+=''+sc(c[i][0])+''; 70 | if(i!=(c.length-1)) 71 | h+=DISPLAY_SEPARATOR; } 72 | return h+DISPLAY_POSTPREND; 73 | } 74 | 75 | function gettrailXHTML( c ) 76 | { 77 | var h=''+DISPLAY_PREPREND; 78 | for(var i=0;i < c.length;i++) 79 | { 80 | h+=''+sc(c[i][0])+''; 81 | if(i!=(c.length-1)) 82 | h+=''+DISPLAY_SEPARATOR+''; } 83 | return h+DISPLAY_POSTPREND+''; 84 | } 85 | 86 | if(document.location.href.toLowerCase().indexOf("http://")==-1) 87 | document.write(gettrail(getcrumbs())); 88 | else 89 | document.write(gettrail(getcrumbs(getdirs()))); 90 | 91 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/scripts/fontsize.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | function init() 18 | { //embedded in the doc 19 | //ndeSetTextSize(); 20 | } 21 | 22 | function checkBrowser(){ 23 | if (!document.getElementsByTagName){ 24 | return true; 25 | } 26 | else{ 27 | return false; 28 | } 29 | } 30 | 31 | 32 | function ndeSetTextSize(chgsize,rs) 33 | { 34 | var startSize; 35 | var newSize; 36 | 37 | if (!checkBrowser) 38 | { 39 | return; 40 | } 41 | 42 | startSize = parseInt(ndeGetDocTextSize()); 43 | 44 | if (!startSize) 45 | { 46 | startSize = 16; 47 | } 48 | 49 | switch (chgsize) 50 | { 51 | case 'incr': 52 | newSize = startSize + 2; 53 | break; 54 | 55 | case 'decr': 56 | newSize = startSize - 2; 57 | break; 58 | 59 | case 'reset': 60 | if (rs) {newSize = rs;} else {newSize = 16;} 61 | break; 62 | 63 | default: 64 | try{ 65 | newSize = parseInt(ndeReadCookie("nde-textsize")); 66 | } 67 | catch(e){ 68 | alert(e); 69 | } 70 | 71 | if (!newSize || newSize == 'NaN') 72 | { 73 | newSize = startSize; 74 | } 75 | break; 76 | 77 | } 78 | 79 | if (newSize < 10) 80 | { 81 | newSize = 10; 82 | } 83 | 84 | newSize += 'px'; 85 | 86 | document.getElementsByTagName('html')[0].style.fontSize = newSize; 87 | document.getElementsByTagName('body')[0].style.fontSize = newSize; 88 | 89 | ndeCreateCookie("nde-textsize", newSize, 365); 90 | } 91 | 92 | function ndeGetDocTextSize() 93 | { 94 | if (!checkBrowser) 95 | { 96 | return 0; 97 | } 98 | 99 | var size = 0; 100 | var body = document.getElementsByTagName('body')[0]; 101 | 102 | if (body.style && body.style.fontSize) 103 | { 104 | size = body.style.fontSize; 105 | } 106 | else if (typeof(getComputedStyle) != 'undefined') 107 | { 108 | size = getComputedStyle(body,'').getPropertyValue('font-size'); 109 | } 110 | else if (body.currentStyle) 111 | { 112 | size = body.currentStyle.fontSize; 113 | } 114 | 115 | //fix IE bug 116 | if( isNaN(size)){ 117 | if(size.substring(size.length-1)=="%"){ 118 | return 119 | } 120 | 121 | } 122 | 123 | return size; 124 | 125 | } 126 | 127 | 128 | 129 | function ndeCreateCookie(name,value,days) 130 | { 131 | var cookie = name + "=" + value + ";"; 132 | 133 | if (days) 134 | { 135 | var date = new Date(); 136 | date.setTime(date.getTime()+(days*24*60*60*1000)); 137 | cookie += " expires=" + date.toGMTString() + ";"; 138 | } 139 | cookie += " path=/"; 140 | 141 | document.cookie = cookie; 142 | 143 | } 144 | 145 | function ndeReadCookie(name) 146 | { 147 | var nameEQ = name + "="; 148 | var ca = document.cookie.split(';'); 149 | 150 | 151 | for(var i = 0; i < ca.length; i++) 152 | { 153 | var c = ca[i]; 154 | while (c.charAt(0) == ' ') 155 | { 156 | c = c.substring(1, c.length); 157 | } 158 | 159 | ctest = c.substring(0,name.length); 160 | 161 | if(ctest == name){ 162 | return c.substring(nameEQ.length,c.length); 163 | } 164 | } 165 | return null; 166 | } 167 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/scripts/getBlank.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * getBlank script - when included in a html file and called from a form text field, will set the value of this field to "" 19 | * if the text value is still the standard value. 20 | * getPrompt script - when included in a html file and called from a form text field, will set the value of this field to the prompt 21 | * if the text value is empty. 22 | * 23 | * Typical usage: 24 | * 25 | * 26 | */ 27 | 41 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/scripts/getMenu.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * This script, when included in a html file, can be used to make collapsible menus 19 | * 20 | * Typical usage: 21 | * 22 | */ 23 | 24 | if (document.getElementById){ 25 | document.write('') 26 | } 27 | 28 | 29 | function SwitchMenu(obj, thePath) 30 | { 31 | var open = 'url("'+thePath + 'images/chapter_open.gif")'; 32 | var close = 'url("'+thePath + 'images/chapter.gif")'; 33 | if(document.getElementById) { 34 | var el = document.getElementById(obj); 35 | var title = document.getElementById(obj+'Title'); 36 | 37 | if(el.style.display != "block"){ 38 | title.style.backgroundImage = open; 39 | el.style.display = "block"; 40 | }else{ 41 | title.style.backgroundImage = close; 42 | el.style.display = "none"; 43 | } 44 | }// end - if(document.getElementById) 45 | }//end - function SwitchMenu(obj) 46 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/scripts/menu.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * This script, when included in a html file, can be used to make collapsible menus 19 | * 20 | * Typical usage: 21 | * 22 | */ 23 | 24 | if (document.getElementById){ 25 | document.write('') 26 | } 27 | 28 | function SwitchMenu(obj) 29 | { 30 | if(document.getElementById) { 31 | var el = document.getElementById(obj); 32 | var title = document.getElementById(obj+'Title'); 33 | 34 | if(obj.indexOf("_selected_")==0&&el.style.display == ""){ 35 | el.style.display = "block"; 36 | title.className = "pagegroupselected"; 37 | } 38 | 39 | if(el.style.display != "block"){ 40 | el.style.display = "block"; 41 | title.className = "pagegroupopen"; 42 | } 43 | else{ 44 | el.style.display = "none"; 45 | title.className = "pagegroup"; 46 | } 47 | }// end - if(document.getElementById) 48 | }//end - function SwitchMenu(obj) 49 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/translations/CommonMessages_de.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/translations/CommonMessages_de.xml -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/translations/CommonMessages_en_US.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | Font size: 20 | Last Published: 21 | Search 22 | Search site with 23 | 24 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/translations/CommonMessages_es.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/translations/CommonMessages_es.xml -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/translations/CommonMessages_fr.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/common/translations/CommonMessages_fr.xml -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/xslt/fo/footerinfo.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Copyright © 40 |   42 | All rights reserved. 43 | 44 | 45 | 46 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 58 | 59 | 60 | 61 | 62 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/xslt/fo/pdfoutline.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 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 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/xslt/html/dotdots.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 39 | 42 | 43 | 44 | 45 | 52 | 53 | 54 | ../ 55 | 56 | 57 | 58 | 59 | 60 | 61 | 73 | 74 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/xslt/html/renderlogo.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | {$name} 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 | 68 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/xslt/html/strip_namespaces.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/common/xslt/svg/document-to-svg.xsl: -------------------------------------------------------------------------------- 1 | 2 | 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 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/book-to-menu.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 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 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/css/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /** 18 | * General 19 | */ 20 | 21 | img { border: 0; } 22 | 23 | #content table { 24 | border: 0; 25 | width: 100%; 26 | } 27 | /*Hack to get IE to render the table at 100%*/ 28 | * html #content table { margin-left: -3px; } 29 | 30 | #content th, 31 | #content td { 32 | margin: 0; 33 | padding: 0; 34 | vertical-align: top; 35 | } 36 | 37 | .clearboth { 38 | clear: both; 39 | } 40 | 41 | .note, .warning, .fixme { 42 | border: solid black 1px; 43 | margin: 1em 3em; 44 | } 45 | 46 | .note .label { 47 | background: #369; 48 | color: white; 49 | font-weight: bold; 50 | padding: 5px 10px; 51 | } 52 | .note .content { 53 | background: #F0F0FF; 54 | color: black; 55 | line-height: 120%; 56 | font-size: 90%; 57 | padding: 5px 10px; 58 | } 59 | .warning .label { 60 | background: #C00; 61 | color: white; 62 | font-weight: bold; 63 | padding: 5px 10px; 64 | } 65 | .warning .content { 66 | background: #FFF0F0; 67 | color: black; 68 | line-height: 120%; 69 | font-size: 90%; 70 | padding: 5px 10px; 71 | } 72 | .fixme .label { 73 | background: #C6C600; 74 | color: black; 75 | font-weight: bold; 76 | padding: 5px 10px; 77 | } 78 | .fixme .content { 79 | padding: 5px 10px; 80 | } 81 | 82 | /** 83 | * Typography 84 | */ 85 | 86 | body { 87 | font-family: verdana, "Trebuchet MS", arial, helvetica, sans-serif; 88 | font-size: 100%; 89 | } 90 | 91 | #content { 92 | font-family: Georgia, Palatino, Times, serif; 93 | font-size: 95%; 94 | } 95 | #tabs { 96 | font-size: 70%; 97 | } 98 | #menu { 99 | font-size: 80%; 100 | } 101 | #footer { 102 | font-size: 70%; 103 | } 104 | 105 | h1, h2, h3, h4, h5, h6 { 106 | font-family: "Trebuchet MS", verdana, arial, helvetica, sans-serif; 107 | font-weight: bold; 108 | margin-top: 1em; 109 | margin-bottom: .5em; 110 | } 111 | 112 | h1 { 113 | margin-top: 0; 114 | margin-bottom: 1em; 115 | font-size: 1.4em; 116 | } 117 | #content h1 { 118 | font-size: 160%; 119 | margin-bottom: .5em; 120 | } 121 | #menu h1 { 122 | margin: 0; 123 | padding: 10px; 124 | background: #336699; 125 | color: white; 126 | } 127 | h2 { font-size: 120%; } 128 | h3 { font-size: 100%; } 129 | h4 { font-size: 90%; } 130 | h5 { font-size: 80%; } 131 | h6 { font-size: 75%; } 132 | 133 | p { 134 | line-height: 120%; 135 | text-align: left; 136 | margin-top: .5em; 137 | margin-bottom: 1em; 138 | } 139 | 140 | #content li, 141 | #content th, 142 | #content td, 143 | #content li ul, 144 | #content li ol{ 145 | margin-top: .5em; 146 | margin-bottom: .5em; 147 | } 148 | 149 | 150 | #content li li, 151 | #minitoc-area li{ 152 | margin-top: 0em; 153 | margin-bottom: 0em; 154 | } 155 | 156 | #content .attribution { 157 | text-align: right; 158 | font-style: italic; 159 | font-size: 85%; 160 | margin-top: 1em; 161 | } 162 | 163 | .codefrag { 164 | font-family: "Courier New", Courier, monospace; 165 | font-size: 110%; 166 | } 167 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/css/print.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | body { 18 | font-family: Verdana, Palatino, serif; 19 | font-size: 12pt; 20 | background: white; 21 | } 22 | 23 | .ad, .trail, .pdflink, #tabs, #menu, #content .toc { 24 | display: none; 25 | } 26 | 27 | #content { 28 | width: 750px; 29 | padding: 0; 30 | float: none !important; 31 | color: black; 32 | background: inherit; 33 | } 34 | 35 | a:link, a:visited { 36 | color: #336699; 37 | background: inherit; 38 | text-decoration: underline; 39 | } 40 | 41 | #top .logo { 42 | padding: 0; 43 | margin: 0 0 2em 0; 44 | } 45 | 46 | #footer { 47 | margin-top: 4em; 48 | } 49 | 50 | acronym { 51 | border: 0; 52 | } -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/chapter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/chapter.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/chapter_open.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/chapter_open.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/current.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/current.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/error.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/header_white_line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/header_white_line.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/info.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/instruction_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/instruction_arrow.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/label.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/label.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/page.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/page.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/pdfdoc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/pdfdoc.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/printer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/printer.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/success.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/warning.png -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/images/xmldoc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stritti/log4js/c159e7327741ccedd48bbd831b893223c7aaf488/log4js-site/xdocs/skins/pelt/images/xmldoc.gif -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/note.txt: -------------------------------------------------------------------------------- 1 | Notes for developer: 2 | 3 | --Legend------------------- 4 | TODO -> blocker 5 | DONE -> blocker 6 | ToDo -> enhancement bug 7 | done -> enhancement bug 8 | 9 | --Issues------------------- 10 | - the corner images should be rendered through svg with the header color. 11 | -> DONE 12 | -> ToDo: get rid of the images and use only divs! 13 | 14 | - the menu points should be displayed "better". 15 | -> DONE 16 | -- Use the krysalis-site menu approach for the overall menu display. 17 | -> DONE 18 | -- Use the old lenya innermenu approch to further enhance the menu . 19 | -> DONE 20 | 21 | - the content area needs some attention. 22 | -> DONE 23 | -- introduce the heading scheme from krysalis () 24 | -> DONE 25 | -> ToDo: make box with round corners 26 | -> done: make underlined with variable border height 27 | -> ToDo: make underline with bottom round corner 28 | -- introduce the toc for each html-page 29 | -> DONE 30 | -- introduce the external-link-images. 31 | -> DONE 32 | 33 | - the publish note should be where now only a border is. 34 | Like
    35 | -> DONE 36 | , but make it configurable. 37 | -> DONE 38 | - footer needs some attention 39 | -> DONE 40 | -- the footer do not have the color profile! Enable it! 41 | -> DONE 42 | -- the footer should as well contain a feedback link. 43 | See http://issues.apache.org/eyebrowse/ReadMsg?listName=forrest-user@xml.apache.org&msgNo=71 44 | -> DONE 45 | 46 | - introduce credits alternativ location 47 | -> DONE 48 | 49 | - border for published / breadtrail / menu /tab divs 50 | -> ToDo -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/tab-to-menu.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 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 | 68 |
  • 69 |
    70 | 71 | 72 |
  • 73 |
    74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
    83 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/xslt/fo/document-to-fo.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/xslt/html/book-to-menu.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 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 | -------------------------------------------------------------------------------- /log4js-site/xdocs/skins/pelt/xslt/html/tab-to-menu.xsl: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 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 | 68 |
  • 69 |
    70 | 71 | 72 |
  • 73 |
    74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
    83 | -------------------------------------------------------------------------------- /log4js-site/xdocs/translations/langcode.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 22 | 23 | English 24 | 28 | 29 | -------------------------------------------------------------------------------- /log4js-site/xdocs/translations/languages_en.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | English 20 | Spanish 21 | Dutch 22 | 23 | -------------------------------------------------------------------------------- /log4js-site/xdocs/translations/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | About 20 | Index 21 | Changes 22 | Todo 23 | Samples 24 | Apache document 25 | Static content 26 | Linking 27 | Wiki page 28 | Ihtml page 29 | Ehtml page 30 | FAQ 31 | Simplifed Docbook 32 | XSP page 33 | 34 | -------------------------------------------------------------------------------- /log4js-site/xdocs/translations/menu_de.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | Über 20 | Index 21 | Änderungen 22 | Todo 23 | Beispiele 24 | Apache Dokumentationsseite 25 | Statischer Inhalt 26 | Linking 27 | Wiki Seite 28 | ihtml Seite 29 | ehtml Seite 30 | FAQ 31 | Vereinfachte Docbook 32 | XSP Seite 33 | 34 | -------------------------------------------------------------------------------- /log4js-site/xdocs/translations/tabs.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | Home 20 | Samples 21 | Apache Logging Projects 22 | 23 | -------------------------------------------------------------------------------- /log4js-solr/README.md: -------------------------------------------------------------------------------- 1 | SOLR LOG RECIEVER 2 | ================= 3 | 4 | As an exmple, I use latest solr, which is version 5. 5 | 6 | Configure server 7 | ---------------- 8 | 9 | Use schema.xml as base. There is no required id field in schema, so you may omit setting this strange value for log 10 | messages. 11 | 12 | You can send arbitrary fields with with underscored suffixes like "collected_money_i" - where _i denotes integer type. 13 | You might be interested in _t (text), _s (string), _b (boolean), _f (float), _dt (date/time). Use final 's' to mark 14 | multivalued field. See schema.xml for details about other types. Feel free to change core schema ! 15 | 16 | Check your jetty version in $SOLR_HOME/server/lib/ directory and download corresponding jetty-servlets.jar from 17 | http://central.maven.org/maven2/org/eclipse/jetty/jetty-servlets/ 18 | 19 | Patch your $SOLR_HOME/server/webapps/solr.war/WEB-INF/web.xml (this might require you unzip solr.war) with CORS filter: 20 | 21 | ```xml 22 | 23 | cross-origin 24 | org.eclipse.jetty.servlets.CrossOriginFilter 25 | 26 | chainPreflight 27 | false 28 | 29 | 30 | 31 | 32 | cross-origin 33 | /* 34 | 35 | ``` 36 | 37 | This will allow your javascript clients to POST their messages without violating browsers' rules. More configuration 38 | options: http://www.eclipse.org/jetty/documentation/current/cross-origin-filter.html 39 | 40 | Javascript logging 41 | ------------------ 42 | 43 | Use 44 | 45 | ``` 46 | http://HOST:PORT/solr/COLLECTION_NAME/update/json/docs?split=/Log4js&f=/Log4js/LoggingEvent/* 47 | ``` 48 | 49 | to post your log messages. Use JSON Appender. 50 | 51 | Sample message: 52 | 53 | ```json 54 | { 55 | "Log4js": [ 56 | { 57 | "LoggingEvent": 58 | { 59 | "logger": "sample", 60 | "level": "INFO", 61 | "message": "this is a message from me", 62 | "referer": "http://true-generals.wg" 63 | } 64 | } 65 | ] 66 | } 67 | ``` 68 | 69 | Known Issues 70 | ------------ 71 | 72 | 1. Anybody can screw up your logs, because update is available to anybody. Should be fixed with Jetty filters. 73 | 2. Exceptions parameter handling. -------------------------------------------------------------------------------- /log4js/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "es2015" ] 3 | } -------------------------------------------------------------------------------- /log4js/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "airbnb", 3 | "rules": { 4 | "id-length": [2, { 5 | "exceptions": ["_"] 6 | }] 7 | } 8 | } -------------------------------------------------------------------------------- /log4js/README.md: -------------------------------------------------------------------------------- 1 | [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) 2 | [![Build Status](https://secure.travis-ci.org/stritti/log4js.png?branch=master)](http://travis-ci.org/stritti/log4js) 3 | Log4js 4 | ====== 5 | -------------------------------------------------------------------------------- /log4js/nbproject/project.properties: -------------------------------------------------------------------------------- 1 | auxiliary.org-netbeans-modules-javascript-grunt.action_2e_build=build 2 | auxiliary.org-netbeans-modules-javascript-grunt.action_2e_clean=clean 3 | auxiliary.org-netbeans-modules-javascript-grunt.action_2e_rebuild=clean build 4 | auxiliary.org-netbeans-modules-javascript-grunt.action_2e_run=run 5 | auxiliary.org-netbeans-modules-javascript-grunt.action_2e_test=test 6 | auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs 7 | files.encoding=UTF-8 8 | site.root.folder= 9 | source.folder= 10 | -------------------------------------------------------------------------------- /log4js/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.web.clientproject 4 | 5 | 6 | log4js 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /log4js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "log4js", 3 | "title": "Log4js - The Logging API for JavaScript", 4 | "description": "Logging Framework for JavaScript", 5 | "version": "2.0.0", 6 | "main": "log4js/src/main/js/log4js.js", 7 | "authors": [ 8 | "stritti (https://github.com/stritti)" 9 | ], 10 | "scripts": { 11 | "watch": "grunt watch", 12 | "build": "grunt build", 13 | "test": "grunt test" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/stritti/log4js.git" 18 | }, 19 | "keywords": [ 20 | "log", 21 | "logging", 22 | "logger", 23 | "log4js", 24 | "log4j" 25 | ], 26 | "license": "Apache-2.0", 27 | "homepage": "http://stritti.github.io/log4js/", 28 | "bugs": { 29 | "url": "https://github.com/stritti/log4js/issues" 30 | }, 31 | "ignore": [ 32 | "**/.*", 33 | "node_modules", 34 | "test", 35 | "tests" 36 | ], 37 | "devDependencies": { 38 | "active-x-obfuscator": "0.0.2", 39 | "chai": "^4.2.0", 40 | "grunt": "^1.0.3", 41 | "grunt-cli": "^1.3.1", 42 | "grunt-contrib-clean": "^2.0.0", 43 | "grunt-contrib-compress": "^1.4.3", 44 | "grunt-contrib-concat": "^1.0.1", 45 | "grunt-contrib-copy": "^1.0.0", 46 | "grunt-contrib-cssmin": "^3.0.0", 47 | "grunt-contrib-jshint": "^2.0.0", 48 | "grunt-contrib-uglify": "^4.0.0", 49 | "grunt-contrib-watch": "^1.1.0", 50 | "grunt-jsdoc": "^2.3.0", 51 | "grunt-karma": "^3.0.0", 52 | "karma": "^3.0.0", 53 | "karma-chrome-launcher": "^2.2.0", 54 | "karma-edge-launcher": "^0.4.2", 55 | "karma-firefox-launcher": "^1.1.0", 56 | "karma-ie-launcher": "^1.0.0", 57 | "karma-mocha": "^1.3.0", 58 | "karma-spec-reporter": "^0.0.32", 59 | "mocha": "^5.2.0", 60 | "uglify-js": "^3.4.9" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /log4js/src/main/js/appender.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Abstract base class for other appenders. 5 | * It is doing nothing. 6 | * 7 | * @constructor 8 | * @author Stephan Strittmatter 9 | */ 10 | Log4js.Appender = function () { 11 | /** 12 | * Reference to calling logger 13 | * @type Log4js.Logger 14 | * @private 15 | */ 16 | this.logger = null; 17 | }; 18 | 19 | Log4js.Appender.prototype = { 20 | /** 21 | * appends the given loggingEvent appender specific 22 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to append 23 | */ 24 | doAppend: function(loggingEvent) { 25 | return; 26 | }, 27 | /** 28 | * clears the Appender 29 | */ 30 | doClear: function() { 31 | return; 32 | }, 33 | 34 | /** 35 | * Set the Layout for this appender. 36 | * @param {Log4js.Layout} layout Layout for formatting loggingEvent 37 | */ 38 | setLayout: function(layout){ 39 | this.layout = layout; 40 | }, 41 | /** 42 | * Set reference to the logger. 43 | * @param {Log4js.Logger} logger The invoking logger 44 | */ 45 | setLogger: function(logger){ 46 | // add listener to the logger methods 47 | logger.onlog.addListener(Log4js.bind(this.doAppend, this)); 48 | logger.onclear.addListener(Log4js.bind(this.doClear, this)); 49 | 50 | this.logger = logger; 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /log4js/src/main/js/appenders/js-alert.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * JS Alert Appender writes the logs to the JavaScript alert dialog box 5 | * @constructor 6 | * @extends Log4js.Appender 7 | * @param logger log4js instance this appender is attached to 8 | * @author Sébastien LECACHEUR 9 | */ 10 | Log4js.JSAlertAppender = function () { 11 | 12 | this.layout = new Log4js.SimpleLayout(); 13 | }; 14 | 15 | Log4js.JSAlertAppender.prototype = Log4js.extend(new Log4js.Appender(), /** @lends Log4js.JSAlertAppender# */ { 16 | /** 17 | * @see Log4js.Appender#doAppend 18 | */ 19 | doAppend: function (loggingEvent) { 20 | alert(this.layout.getHeader() + this.layout.format(loggingEvent) + this.layout.getFooter()); 21 | }, 22 | /** 23 | * toString 24 | */ 25 | toString: function () { 26 | return "Log4js.JSAlertAppender"; 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /log4js/src/main/js/appenders/metatag.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Metatag Appender writing the logs to meta tags 5 | * 6 | * @extends Log4js.Appender 7 | * @constructor 8 | * @author Stephan Strittmatter 9 | */ 10 | Log4js.MetatagAppender = function () { 11 | this.currentLine = 0; 12 | }; 13 | Log4js.MetatagAppender.prototype = Log4js.extend(new Log4js.Appender(), /** @lends Log4js.MetatagAppender# */ { 14 | /** 15 | * @param loggingEvent event to be logged 16 | * @see Log4js.Appender#doAppend 17 | */ 18 | doAppend: function (loggingEvent) { 19 | var now = new Date(); 20 | var lines = loggingEvent.message.split("\n"); 21 | var headTag = document.getElementsByTagName("head")[0]; 22 | 23 | for (var i = 1; i <= lines.length; i++) { 24 | var value = lines[i - 1]; 25 | if (i === 1) { 26 | value = loggingEvent.level.toString() + ": " + value; 27 | } else { 28 | value = "> " + value; 29 | } 30 | 31 | var metaTag = document.createElement("meta"); 32 | metaTag.setAttribute("name", "X-log4js:" + this.currentLine); 33 | metaTag.setAttribute("content", value); 34 | headTag.appendChild(metaTag); 35 | this.currentLine += 1; 36 | } 37 | }, 38 | /** 39 | * toString 40 | */ 41 | toString: function () { 42 | return "Log4js.MetatagAppender"; 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /log4js/src/main/js/appenders/windows-event.js: -------------------------------------------------------------------------------- 1 | /* global Log4js, log4jsLogger */ 2 | 3 | /** 4 | * Windows Event Appender writes the logs to the Windows Event log. 5 | * PLEASE NOTE - Only works in IE..uses ActiveX to write to Windows Event log 6 | * 7 | * @extends Log4js.Appender 8 | * @constructor 9 | * @param logger log4js instance this appender is attached to 10 | * @author Seth Chisamore 11 | */ 12 | Log4js.WindowsEventAppender = function () { 13 | 14 | this.layout = new Log4js.SimpleLayout(); 15 | 16 | try { 17 | this.shell = new ActiveXObject("WScript.Shell"); 18 | } catch (e) { 19 | log4jsLogger && log4jsLogger.error(e); 20 | } 21 | }; 22 | 23 | Log4js.WindowsEventAppender.prototype = Log4js.extend(new Log4js.Appender(), /** @lends Log4js.WindowsEventAppender# */ { 24 | /** 25 | * @param loggingEvent event to be logged 26 | * @see Log4js.Appender#doAppend 27 | */ 28 | doAppend: function (loggingEvent) { 29 | var winLevel = 4; 30 | 31 | // Map log level to windows event log level. 32 | // Windows events: - SUCCESS: 0, ERROR: 1, WARNING: 2, INFORMATION: 4, AUDIT_SUCCESS: 8, AUDIT_FAILURE: 16 33 | switch (loggingEvent.level) { 34 | case Log4js.Level.FATAL: 35 | winLevel = 1; 36 | break; 37 | case Log4js.Level.ERROR: 38 | winLevel = 1; 39 | break; 40 | case Log4js.Level.WARN: 41 | winLevel = 2; 42 | break; 43 | default: 44 | winLevel = 4; 45 | break; 46 | } 47 | 48 | try { 49 | this.shell.LogEvent(winLevel, this.level.format(loggingEvent)); 50 | } catch (e) { 51 | log4jsLogger && log4jsLogger.error(e); 52 | } 53 | }, 54 | /** 55 | * toString 56 | */ 57 | toString: function () { 58 | return "Log4js.WindowsEventAppender"; 59 | } 60 | }); 61 | -------------------------------------------------------------------------------- /log4js/src/main/js/custom-event.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Log4js CustomEvent 5 | * @constructor 6 | * @author Corey Johnson - original code in Lumberjack (http://gleepglop.com/javascripts/logger/) 7 | * @author Seth Chisamore - adapted for Log4js 8 | * @private 9 | */ 10 | Log4js.CustomEvent = function () { 11 | this.listeners = []; 12 | }; 13 | 14 | Log4js.CustomEvent.prototype = { 15 | /** 16 | * @param method method to be added 17 | */ 18 | addListener: function (method) { 19 | this.listeners.push(method); 20 | }, 21 | /** 22 | * @param method method to be removed 23 | */ 24 | removeListener: function (method) { 25 | var foundIndexes = this.findListenerIndexes(method); 26 | 27 | for (var i = 0; i < foundIndexes.length; i++) { 28 | this.listeners.splice(foundIndexes[i], 1); 29 | } 30 | }, 31 | /** 32 | * @param handler 33 | */ 34 | dispatch: function (handler) { 35 | for (var i = 0; i < this.listeners.length; i++) { 36 | try { 37 | this.listeners[i](handler); 38 | } catch (e) { 39 | log4jsLogger && log4jsLogger.warn("Could not run the listener " + this.listeners[i] + ". \n" + e); 40 | } 41 | } 42 | }, 43 | /** 44 | * @private 45 | * @param method 46 | */ 47 | findListenerIndexes: function (method) { 48 | var indexes = []; 49 | for (var i = 0; i < this.listeners.length; i++) { 50 | if (this.listeners[i] === method) { 51 | indexes.push(i); 52 | } 53 | } 54 | 55 | return indexes; 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /log4js/src/main/js/date-formatter.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Date Formatter 5 | * addZero() and formatDate() are courtesy of Mike Golding: 6 | * http://www.mikezilla.com/exp0015.html 7 | * @constructor 8 | */ 9 | Log4js.DateFormatter = function() { 10 | return; 11 | }; 12 | /** 13 | * default format of date (ISO-8601) 14 | * @static 15 | * @final 16 | */ 17 | Log4js.DateFormatter.DEFAULT_DATE_FORMAT = "yyyy-MM-ddThh:mm:ssO"; 18 | 19 | 20 | Log4js.DateFormatter.prototype = { 21 | /** 22 | * Formats the given date by the given pattern.
    23 | * Following switches are supported: 24 | *
      25 | *
    • yyyy: The year
    • 26 | *
    • MM: the month
    • 27 | *
    • dd: the day of month
    • 28 | *
    • hh: the hour
    • 29 | *
    • mm: minutes
    • 30 | *
    • O: timezone offset
    • 31 | *
    32 | * @param {Date} vDate the date to format 33 | * @param {String} vFormat the format pattern 34 | * @return {String} formatted date string 35 | * @static 36 | */ 37 | formatDate : function(vDate, vFormat) { 38 | var vDay = this.addZero(vDate.getDate()); 39 | var vMonth = this.addZero(vDate.getMonth()+1); 40 | var vYearLong = this.addZero(vDate.getFullYear()); 41 | var vYearShort = this.addZero(vDate.getFullYear().toString().substring(3,4)); 42 | var vYear = (vFormat.indexOf("yyyy")>-1?vYearLong:vYearShort); 43 | var vHour = this.addZero(vDate.getHours()); 44 | var vMinute = this.addZero(vDate.getMinutes()); 45 | var vSecond = this.addZero(vDate.getSeconds()); 46 | var vTimeZone = this.O(vDate); 47 | var vDateString = vFormat.replace(/dd/g, vDay).replace(/MM/g, vMonth).replace(/y{1,4}/g, vYear); 48 | vDateString = vDateString.replace(/hh/g, vHour).replace(/mm/g, vMinute).replace(/ss/g, vSecond); 49 | vDateString = vDateString.replace(/O/g, vTimeZone); 50 | return vDateString; 51 | }, 52 | /** 53 | * Formats the given date by the given pattern in UTC without timezone specific information.
    54 | * Following switches are supported: 55 | *
      56 | *
    • yyyy: The year
    • 57 | *
    • MM: the month
    • 58 | *
    • dd: the day of month
    • 59 | *
    • hh: the hour
    • 60 | *
    • mm: minutes
    • 61 | *
    62 | * @param {Date} vDate the date to format 63 | * @param {String} vFormat the format pattern 64 | * @return {String} formatted date string 65 | * @static 66 | */ 67 | formatUTCDate : function(vDate, vFormat) { 68 | var vDay = this.addZero(vDate.getUTCDate()); 69 | var vMonth = this.addZero(vDate.getUTCMonth()+1); 70 | var vYearLong = this.addZero(vDate.getUTCFullYear()); 71 | var vYearShort = this.addZero(vDate.getUTCFullYear().toString().substring(3,4)); 72 | var vYear = (vFormat.indexOf("yyyy")>-1?vYearLong:vYearShort); 73 | var vHour = this.addZero(vDate.getUTCHours()); 74 | var vMinute = this.addZero(vDate.getUTCMinutes()); 75 | var vSecond = this.addZero(vDate.getUTCSeconds()); 76 | var vDateString = vFormat.replace(/dd/g, vDay).replace(/MM/g, vMonth).replace(/y{1,4}/g, vYear); 77 | vDateString = vDateString.replace(/hh/g, vHour).replace(/mm/g, vMinute).replace(/ss/g, vSecond); 78 | return vDateString; 79 | }, 80 | 81 | /** 82 | * @private 83 | * @static 84 | */ 85 | addZero : function(vNumber) { 86 | return ((vNumber < 10) ? "0" : "") + vNumber; 87 | }, 88 | 89 | /** 90 | * Formates the TimeOffest 91 | * Thanks to http://www.svendtofte.com/code/date_format/ 92 | * @private 93 | */ 94 | O : function (date) { 95 | // Difference to Greenwich time (GMT) in hours 96 | var os = Math.abs(date.getTimezoneOffset()); 97 | var h = String(Math.floor(os/60)); 98 | var m = String(os%60); 99 | if(h.length == 1) h = "0" + h; 100 | if(m.length == 1) m = "0" + m; 101 | return date.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m; 102 | } 103 | }; 104 | -------------------------------------------------------------------------------- /log4js/src/main/js/fifo-buffer.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * FIFO buffer 5 | * @constructor 6 | * @private 7 | */ 8 | Log4js.FifoBuffer = function() 9 | { 10 | this.array = []; 11 | }; 12 | 13 | Log4js.FifoBuffer.prototype = { 14 | 15 | /** 16 | * @param {Object} obj any object added to buffer 17 | */ 18 | push : function(obj) { 19 | this.array[this.array.length] = obj; 20 | return this.array.length; 21 | }, 22 | 23 | /** 24 | * @return first putted in Object 25 | */ 26 | pull : function() { 27 | if (this.array.length > 0) { 28 | var firstItem = this.array[0]; 29 | for (var i = 0; i < this.array.length - 1; i++) { 30 | this.array[i] = this.array[i + 1]; 31 | } 32 | this.array.length = this.array.length - 1; 33 | return firstItem; 34 | } 35 | return null; 36 | }, 37 | 38 | length : function() { 39 | return this.array.length; 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /log4js/src/main/js/layout.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Interface for Layouts. 5 | * Use this Layout as "interface" for other Layouts. It is doing nothing. 6 | * 7 | * @constructor 8 | * @author Stephan Strittmatter 9 | */ 10 | Log4js.Layout = function(){}; 11 | Log4js.Layout.prototype = { 12 | /** 13 | * Implement this method to create your own layout format. 14 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to format 15 | * @return formatted String 16 | * @type String 17 | */ 18 | format: function(loggingEvent) { 19 | return ""; 20 | }, 21 | /** 22 | * Returns the content type output by this layout. 23 | * @return The base class returns "text/plain". 24 | * @type String 25 | */ 26 | getContentType: function() { 27 | return "text/plain"; 28 | }, 29 | /** 30 | * @return Returns the header for the layout format. The base class returns null. 31 | * @type String 32 | */ 33 | getHeader: function() { 34 | return null; 35 | }, 36 | /** 37 | * @return Returns the footer for the layout format. The base class returns null. 38 | * @type String 39 | */ 40 | getFooter: function() { 41 | return null; 42 | }, 43 | 44 | /** 45 | * @return Separator between events 46 | * @type String 47 | */ 48 | getSeparator: function() { 49 | return ""; 50 | } 51 | }; 52 | -------------------------------------------------------------------------------- /log4js/src/main/js/layouts/basic.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * BasicLayout is a simple layout for storing the loggs. The loggs are stored 5 | * in following format: 6 | *
     7 |  * categoryName~startTime [logLevel] message\n
     8 |  * 
    9 | * 10 | * @constructor 11 | * @extends Log4js.Layout 12 | * @author Stephan Strittmatter 13 | */ 14 | Log4js.BasicLayout = function() { 15 | this.LINE_SEP = "\n"; 16 | }; 17 | 18 | Log4js.BasicLayout.prototype = Log4js.extend(new Log4js.Layout(), /** @lends Log4js.BasicLayout# */ { 19 | /** 20 | * Implement this method to create your own layout format. 21 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to format 22 | * @return formatted String 23 | * @type String 24 | */ 25 | format: function(loggingEvent) { 26 | return loggingEvent.categoryName + "~" + loggingEvent.startTime.toLocaleString() + " [" + loggingEvent.level.toString() + "] " + loggingEvent.message + this.LINE_SEP; 27 | }, 28 | /** 29 | * Returns the content type output by this layout. 30 | * @return The base class returns "text/plain". 31 | * @type String 32 | */ 33 | getContentType: function() { 34 | return "text/plain"; 35 | }, 36 | /** 37 | * @return Returns the header for the layout format. The base class returns null. 38 | * @type String 39 | */ 40 | getHeader: function() { 41 | return ""; 42 | }, 43 | /** 44 | * @return Returns the footer for the layout format. The base class returns null. 45 | * @type String 46 | */ 47 | getFooter: function() { 48 | return ""; 49 | } 50 | }); 51 | -------------------------------------------------------------------------------- /log4js/src/main/js/layouts/html.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * HtmlLayout write the logs in Html format. 5 | * 6 | * @constructor 7 | * @extends Log4js.Layout 8 | * @author Stephan Strittmatter 9 | */ 10 | Log4js.HtmlLayout = function() {return;}; 11 | 12 | Log4js.HtmlLayout.prototype = Log4js.extend(new Log4js.Layout(), /** @lends Log4js.HtmlLayout# */ { 13 | /** 14 | * Implement this method to create your own layout format. 15 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to format 16 | * @return formatted String 17 | * @type String 18 | */ 19 | format: function(loggingEvent) { 20 | return "
    " + loggingEvent.getFormattedTimestamp() + " - " + loggingEvent.level.toString() + " - " + loggingEvent.message + "
    \n"; 21 | }, 22 | /** 23 | * Returns the content type output by this layout. 24 | * @return The base class returns "text/html". 25 | * @type String 26 | */ 27 | getContentType: function() { 28 | return "text/html"; 29 | }, 30 | /** 31 | * @return Returns the header for the layout format. The base class returns null. 32 | * @type String 33 | */ 34 | getHeader: function() { 35 | return "log4js</head><body>"; 36 | }, 37 | /** 38 | * @return Returns the footer for the layout format. The base class returns null. 39 | * @type String 40 | */ 41 | getFooter: function() { 42 | return "</body></html>"; 43 | }, 44 | 45 | getStyle: function(loggingEvent) 46 | { 47 | var style; 48 | if (loggingEvent.level.toString().search(/ERROR/) != -1) { 49 | style = 'color:red'; 50 | } else if (loggingEvent.level.toString().search(/FATAL/) != -1) { 51 | style = 'color:red'; 52 | } else if (loggingEvent.level.toString().search(/WARN/) != -1) { 53 | style = 'color:orange'; 54 | } else if (loggingEvent.level.toString().search(/DEBUG/) != -1) { 55 | style = 'color:green'; 56 | } else if (loggingEvent.level.toString().search(/INFO/) != -1) { 57 | style = 'color:white'; 58 | } else { 59 | style = 'color:yellow'; 60 | } 61 | return style; 62 | } 63 | }); 64 | -------------------------------------------------------------------------------- /log4js/src/main/js/layouts/json.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * JSONLayout write the logs in JSON format. 5 | * JSON library is required to use this Layout. See also {@link http://www.json.org} 6 | * @constructor 7 | * @extends Log4js.Layout 8 | * @author Stephan Strittmatter 9 | */ 10 | Log4js.JSONLayout = function() { 11 | this.df = new Log4js.DateFormatter(); 12 | }; 13 | Log4js.JSONLayout.prototype = Log4js.extend(new Log4js.Layout(), /** @lends Log4js.JSONLayout# */ { 14 | /** 15 | * Implement this method to create your own layout format. 16 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to format 17 | * @return formatted String 18 | * @type String 19 | */ 20 | format: function(loggingEvent) { 21 | 22 | var useragent = "unknown"; 23 | try { 24 | useragent = navigator.userAgent; 25 | } catch(e){ 26 | useragent = "unknown"; 27 | } 28 | 29 | var referer = "unknown"; 30 | try { 31 | referer = location.href; 32 | } catch(e){ 33 | referer = "unknown"; 34 | } 35 | 36 | var jsonString = "{\n \"LoggingEvent\": {\n"; 37 | 38 | jsonString += "\t\"logger\": \"" + loggingEvent.categoryName + "\",\n"; 39 | jsonString += "\t\"level\": \"" + loggingEvent.level.toString() + "\",\n"; 40 | jsonString += this.formatMessage(loggingEvent.message); 41 | jsonString += "\t\"referer\": \"" + referer + "\",\n"; 42 | jsonString += "\t\"useragent\": \"" + useragent + "\",\n"; 43 | jsonString += "\t\"timestamp\": \"" + this.df.formatUTCDate(loggingEvent.startTime, "yyyy-MM-ddThh:mm:ssZ") + "\",\n"; 44 | jsonString += "\t\"exception\": \"" + loggingEvent.exception + "\"\n"; 45 | jsonString += "}}"; 46 | 47 | return jsonString; 48 | }, 49 | 50 | /** 51 | * Writes message object or string into given string stream. 52 | */ 53 | formatMessage: function(message) { 54 | var stream = ""; 55 | if((typeof message) == "string") { 56 | stream += "\t\"message\": \"" + message + "\",\n"; 57 | } else if((typeof message) == "object") { 58 | if("message" in message) { 59 | stream += "\t\"message\": \"" + message.message + "\",\n"; 60 | } 61 | for(var property in message) { 62 | if(property == "message") continue; 63 | var val = message[property]; 64 | if(val instanceof Date) 65 | stream += "\t\"" + property + "_dt\": \"" + this.df.formatUTCDate(val, "yyyy-MM-ddThh:mm:ssZ") + "\",\n"; 66 | else { 67 | switch(typeof val) { 68 | case "string": 69 | stream += "\t\"" + property + "_s\": \"" + val + "\",\n"; 70 | break; 71 | case "number": 72 | stream += "\t\"" + property + "_l\": " + val + ",\n"; 73 | break; 74 | default: 75 | stream += "\t\"" + property + "_s\": \"" + val.toString() + "\",\n"; 76 | break; 77 | } 78 | } 79 | } 80 | } else { 81 | stream += "\t\"message\": \"" + message.toString() + "\",\n"; 82 | } 83 | return stream; 84 | }, 85 | /** 86 | * Returns the content type output by this layout. 87 | * @return The base class returns "text/xml". 88 | * @type String 89 | */ 90 | getContentType: function() { 91 | return "text/json"; 92 | }, 93 | /** 94 | * @return Returns the header for the layout format. The base class returns null. 95 | * @type String 96 | */ 97 | getHeader: function() { 98 | return "{\"Log4js\": [\n"; 99 | }, 100 | /** 101 | * @return Returns the footer for the layout format. The base class returns null. 102 | * @type String 103 | */ 104 | getFooter: function() { 105 | return "\n]}"; 106 | }, 107 | 108 | getSeparator: function() { 109 | return ",\n"; 110 | } 111 | }); 112 | -------------------------------------------------------------------------------- /log4js/src/main/js/layouts/simple.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * SimpleLayout consists of the level of the log statement, followed by " - " 5 | * and then the log message itself. For example, 6 | * <code>DEBUG - Hello world</code> 7 | * 8 | * @constructor 9 | * @extends Log4js.Layout 10 | * @author Stephan Strittmatter 11 | */ 12 | Log4js.SimpleLayout = function() { 13 | this.LINE_SEP = "\n"; 14 | this.LINE_SEP_LEN = 1; 15 | }; 16 | 17 | Log4js.SimpleLayout.prototype = Log4js.extend(new Log4js.Layout(), /** @lends Log4js.SimpleLayout# */ { 18 | /** 19 | * Implement this method to create your own layout format. 20 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to format 21 | * @return formatted String 22 | * @type String 23 | */ 24 | format: function(loggingEvent) { 25 | return loggingEvent.level.toString() + " - " + loggingEvent.message + this.LINE_SEP; 26 | }, 27 | /** 28 | * Returns the content type output by this layout. 29 | * @return The base class returns "text/plain". 30 | * @type String 31 | */ 32 | getContentType: function() { 33 | return "text/plain"; 34 | }, 35 | /** 36 | * @return Returns the header for the layout format. The base class returns null. 37 | * @type String 38 | */ 39 | getHeader: function() { 40 | return ""; 41 | }, 42 | /** 43 | * @return Returns the footer for the layout format. The base class returns null. 44 | * @type String 45 | */ 46 | getFooter: function() { 47 | return ""; 48 | } 49 | }); 50 | -------------------------------------------------------------------------------- /log4js/src/main/js/layouts/xml.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * XMLLayout write the logs in XML format. 5 | * Layout is simmilar to log4j's XMLLayout: 6 | * <pre> 7 | * <log4js:event category="category" level="Level" client="Client" referer="ref" timestam="Date"> 8 | * <log4js:message>Logged message</log4js:message> 9 | * </log4js:event> 10 | * </pre> 11 | * @constructor 12 | * @extends Log4js.Layout 13 | * @author Stephan Strittmatter 14 | */ 15 | Log4js.XMLLayout = function () { 16 | return; 17 | }; 18 | Log4js.XMLLayout.prototype = Log4js.extend(new Log4js.Layout(), /** @lends Log4js.XMLLayout# */ { 19 | /** 20 | * Implement this method to create your own layout format. 21 | * @param {Log4js.LoggingEvent} loggingEvent loggingEvent to format 22 | * @return formatted String 23 | * @type String 24 | */ 25 | format: function (loggingEvent) { 26 | var useragent = "unknown"; 27 | try { 28 | useragent = navigator.userAgent; 29 | } catch (e) { 30 | useragent = "unknown"; 31 | } 32 | 33 | var referer = "unknown"; 34 | try { 35 | referer = location.href; 36 | } catch (e) { 37 | referer = "unknown"; 38 | } 39 | 40 | var content = "<log4js:event logger=\""; 41 | content += loggingEvent.categoryName + "\" level=\""; 42 | content += loggingEvent.level.toString() + "\" useragent=\""; 43 | content += useragent + "\" referer=\""; 44 | content += referer.replace(/&/g, "&") + "\" timestamp=\""; 45 | content += loggingEvent.getFormattedTimestamp() + "\">\n"; 46 | content += "\t<log4js:message><![CDATA[" + this.escapeCdata(loggingEvent.message) + "]]></log4js:message>\n"; 47 | 48 | if (loggingEvent.exception) { 49 | content += this.formatException(loggingEvent.exception); 50 | } 51 | content += "</log4js:event>\n"; 52 | 53 | return content; 54 | }, 55 | /** 56 | * Returns the content type output by this layout. 57 | * @return The base class returns "text/xml". 58 | * @type String 59 | */ 60 | getContentType: function () { 61 | return "text/xml"; 62 | }, 63 | /** 64 | * @return Returns the header for the layout format. The base class returns null. 65 | * @type String 66 | */ 67 | getHeader: function () { 68 | return "<log4js:eventSet version=\"" + Log4js.version + 69 | "\" xmlns:log4js=\"http://stritti.github.io/log4js//2007/log4js/\">\n"; 70 | }, 71 | /** 72 | * @return Returns the footer for the layout format. The base class returns null. 73 | * @type String 74 | */ 75 | getFooter: function () { 76 | return "</log4js:eventSet>\n"; 77 | }, 78 | getSeparator: function () { 79 | return "\n"; 80 | }, 81 | /** 82 | * better readable formatted Exceptions. 83 | * @param ex {Exception} the exception to be formatted. 84 | * @return {String} the formatted String representation of the exception. 85 | * @private 86 | */ 87 | formatException: function (ex) { 88 | if (ex) { 89 | var exStr = "\t<log4js:throwable>"; 90 | if (ex.message) { 91 | exStr += "\t\t<log4js:message><![CDATA[" + this.escapeCdata(ex.message) + "]]></log4js:message>\n"; 92 | } 93 | if (ex.description) { 94 | exStr += "\t\t<log4js:description><![CDATA[" + this.escapeCdata(ex.description) + "]]></log4js:description>\n"; 95 | } 96 | 97 | exStr += "\t\t<log4js:stacktrace>"; 98 | exStr += "\t\t\t<log4js:location fileName=\"" + ex.fileName + "\" lineNumber=\"" + ex.lineNumber + "\" />"; 99 | exStr += "\t\t</log4js:stacktrace>"; 100 | exStr = "\t</log4js:throwable>"; 101 | return exStr; 102 | } 103 | return null; 104 | }, 105 | /** 106 | * Escape Cdata messages 107 | * @param str {String} message to escape 108 | * @return {String} the escaped message 109 | * @private 110 | */ 111 | escapeCdata: function (str) { 112 | return str.replace(/\]\]>/, "]]>]]><![CDATA["); 113 | } 114 | }); 115 | -------------------------------------------------------------------------------- /log4js/src/main/js/level.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Log4js.Level Enumeration. Do not use directly. Use static objects instead. 5 | * @constructor 6 | * @param {Number} level number of level 7 | * @param {String} levelString String representation of level 8 | * @private 9 | */ 10 | Log4js.Level = function(level, levelStr) { 11 | this.level = level; 12 | this.levelStr = levelStr; 13 | }; 14 | 15 | Log4js.Level.prototype = { 16 | /** 17 | * converts given String to corresponding Level 18 | * @param {String} sArg String value of Level 19 | * @param {Log4js.Level} defaultLevel default Level, if no String representation 20 | * @return Level object 21 | * @type Log4js.Level 22 | */ 23 | toLevel: function(sArg, defaultLevel) { 24 | if(sArg === null) { 25 | return defaultLevel; 26 | } 27 | 28 | if(typeof sArg == "string") { 29 | var s = sArg.toUpperCase(); 30 | 31 | switch(s) { 32 | case "ALL": return Log4js.Level.ALL; 33 | case "DEBUG": return Log4js.Level.DEBUG; 34 | case "INFO": return Log4js.Level.INFO; 35 | case "WARN": return Log4js.Level.WARN; 36 | case "ERROR": return Log4js.Level.ERROR; 37 | case "FATAL": return Log4js.Level.FATAL; 38 | case "OFF": return Log4js.Level.OFF; 39 | case "TRACE": return Log4js.Level.TRACE; 40 | default: return defaultLevel; 41 | } 42 | } else if(typeof sArg == "number") { 43 | switch(sArg) { 44 | case ALL_INT: return Log4js.Level.ALL; 45 | case DEBUG_INT: return Log4js.Level.DEBUG; 46 | case INFO_INT: return Log4js.Level.INFO; 47 | case WARN_INT: return Log4js.Level.WARN; 48 | case ERROR_INT: return Log4js.Level.ERROR; 49 | case FATAL_INT: return Log4js.Level.FATAL; 50 | case OFF_INT: return Log4js.Level.OFF; 51 | case TRACE_INT: return Log4js.Level.TRACE; 52 | default: return defaultLevel; 53 | } 54 | } else { 55 | return defaultLevel; 56 | } 57 | }, 58 | /** 59 | * @return converted Level to String 60 | * @type String 61 | */ 62 | toString: function() { 63 | return this.levelStr; 64 | }, 65 | /** 66 | * @return internal Number value of Level 67 | * @type Number 68 | */ 69 | valueOf: function() { 70 | return this.level; 71 | } 72 | }; 73 | 74 | // Static variables 75 | /** 76 | * @private 77 | */ 78 | Log4js.Level.OFF_INT = Number.MAX_VALUE; 79 | /** 80 | * @private 81 | */ 82 | Log4js.Level.FATAL_INT = 50000; 83 | /** 84 | * @private 85 | */ 86 | Log4js.Level.ERROR_INT = 40000; 87 | /** 88 | * @private 89 | */ 90 | Log4js.Level.WARN_INT = 30000; 91 | /** 92 | * @private 93 | */ 94 | Log4js.Level.INFO_INT = 20000; 95 | /** 96 | * @private 97 | */ 98 | Log4js.Level.DEBUG_INT = 10000; 99 | /** 100 | * @private 101 | */ 102 | Log4js.Level.TRACE_INT = 5000; 103 | /** 104 | * @private 105 | */ 106 | Log4js.Level.ALL_INT = Number.MIN_VALUE; 107 | 108 | /** 109 | * Logging Level OFF - all disabled 110 | * @type Log4js.Level 111 | * @static 112 | */ 113 | Log4js.Level.OFF = new Log4js.Level(Log4js.Level.OFF_INT, "OFF"); 114 | /** 115 | * Logging Level Fatal 116 | * @type Log4js.Level 117 | * @static 118 | */ 119 | Log4js.Level.FATAL = new Log4js.Level(Log4js.Level.FATAL_INT, "FATAL"); 120 | /** 121 | * Logging Level Error 122 | * @type Log4js.Level 123 | * @static 124 | */ 125 | Log4js.Level.ERROR = new Log4js.Level(Log4js.Level.ERROR_INT, "ERROR"); 126 | /** 127 | * Logging Level Warn 128 | * @type Log4js.Level 129 | * @static 130 | */ 131 | Log4js.Level.WARN = new Log4js.Level(Log4js.Level.WARN_INT, "WARN"); 132 | /** 133 | * Logging Level Info 134 | * @type Log4js.Level 135 | * @static 136 | */ 137 | Log4js.Level.INFO = new Log4js.Level(Log4js.Level.INFO_INT, "INFO"); 138 | /** 139 | * Logging Level Debug 140 | * @type Log4js.Level 141 | * @static 142 | */ 143 | Log4js.Level.DEBUG = new Log4js.Level(Log4js.Level.DEBUG_INT, "DEBUG"); 144 | /** 145 | * Logging Level Trace 146 | * @type Log4js.Level 147 | * @static 148 | */ 149 | Log4js.Level.TRACE = new Log4js.Level(Log4js.Level.TRACE_INT, "TRACE"); 150 | /** 151 | * Logging Level All - All traces are enabled 152 | * @type Log4js.Level 153 | * @static 154 | */ 155 | Log4js.Level.ALL = new Log4js.Level(Log4js.Level.ALL_INT, "ALL"); 156 | -------------------------------------------------------------------------------- /log4js/src/main/js/log4js-all.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * internal Logger to be used 5 | * @private 6 | */ 7 | var log4jsLogger = Log4js.getLogger("Log4js"); 8 | log4jsLogger.addAppender(new Log4js.BrowserConsoleAppender()); 9 | log4jsLogger.setLevel(Log4js.Level.ALL); 10 | -------------------------------------------------------------------------------- /log4js/src/main/js/logging-event.js: -------------------------------------------------------------------------------- 1 | /* global Log4js */ 2 | 3 | /** 4 | * Models a logging event. 5 | * @constructor 6 | * @param {String} categoryName name of category 7 | * @param {Log4js.Level} level level of message 8 | * @param {String} message message to log 9 | * @param {Log4js.Logger} logger the associated logger 10 | * @author Seth Chisamore 11 | */ 12 | Log4js.LoggingEvent = function(categoryName, level, message, exception, logger) { 13 | /** 14 | * the timestamp of the Logging Event 15 | * @type Date 16 | * @private 17 | */ 18 | this.startTime = new Date(); 19 | /** 20 | * category of event 21 | * @type String 22 | * @private 23 | */ 24 | this.categoryName = categoryName; 25 | /** 26 | * the logging message 27 | * @type String 28 | * @private 29 | */ 30 | this.message = message; 31 | /** 32 | * the logging exception 33 | * @type Exception 34 | * @private 35 | */ 36 | this.exception = exception; 37 | /** 38 | * level of log 39 | * @type Log4js.Level 40 | * @private 41 | */ 42 | this.level = level; 43 | /** 44 | * reference to logger 45 | * @type Log4js.Logger 46 | * @private 47 | */ 48 | this.logger = logger; 49 | }; 50 | 51 | Log4js.LoggingEvent.prototype = { 52 | /** 53 | * get the timestamp formatted as String. 54 | * @return {String} formatted timestamp 55 | * @see Log4js#setDateFormat() 56 | */ 57 | getFormattedTimestamp: function() { 58 | if(this.logger) { 59 | return this.logger.getFormattedTimestamp(this.startTime); 60 | } else { 61 | return this.startTime.toGMTString(); 62 | } 63 | } 64 | }; 65 | -------------------------------------------------------------------------------- /log4js/src/main/resources/log4js.dtd: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" ?> 2 | <!-- 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 | --> 17 | <!-- 18 | @version 0.3 19 | @author Stephan Strittmatter - https://github.com/stritti 20 | @deprecated will be supported no longer. Use log4js.xsd instead. 21 | --> 22 | 23 | 24 | <!ELEMENT root-ref EMPTY> 25 | 26 | <!ELEMENT logger-ref EMPTY> 27 | <!ATTLIST logger-ref 28 | ref IDREF #REQUIRED 29 | > 30 | 31 | <!ELEMENT param EMPTY> 32 | <!ATTLIST param 33 | name CDATA #REQUIRED 34 | value CDATA #REQUIRED 35 | > 36 | 37 | 38 | <!-- The priority class is org.apache.log4j.Level by default --> 39 | <!ELEMENT priority (param*)> 40 | <!ATTLIST priority 41 | class CDATA #IMPLIED 42 | value CDATA #REQUIRED 43 | > 44 | 45 | <!-- The level class is org.apache.log4j.Level by default --> 46 | <!ELEMENT level (param*)> 47 | <!ATTLIST level 48 | class CDATA #IMPLIED 49 | value CDATA #REQUIRED 50 | > 51 | 52 | 53 | <!-- If no level element is specified, then the configurator MUST not --> 54 | <!-- touch the level of the named category. --> 55 | <!ELEMENT category (param*,(priority|level)?,appender-ref*)> 56 | <!ATTLIST category 57 | class CDATA #IMPLIED 58 | name CDATA #REQUIRED 59 | additivity (true|false) "true" 60 | > 61 | 62 | <!-- If no level element is specified, then the configurator MUST not --> 63 | <!-- touch the level of the named logger. --> 64 | <!ELEMENT logger (level?,appender-ref*)> 65 | <!ATTLIST logger 66 | name ID #REQUIRED 67 | additivity (true|false) "true" 68 | > 69 | 70 | 71 | <!ELEMENT categoryFactory (param*)> 72 | <!ATTLIST categoryFactory 73 | class CDATA #REQUIRED> 74 | 75 | <!ELEMENT appender-ref EMPTY> 76 | <!ATTLIST appender-ref 77 | ref IDREF #REQUIRED 78 | > 79 | 80 | 81 | <!-- ==================================================================== --> 82 | <!-- A logging event --> 83 | <!-- ==================================================================== --> 84 | <!ELEMENT log4js:eventSet (log4js:event*)> 85 | <!ATTLIST log4js:eventSet 86 | xmlns:log4js CDATA #FIXED "http://stritti.github.io/log4js//log4js/" 87 | version (0.2|0.3) "0.3" 88 | includesLocationInfo (true|false) "true" 89 | > 90 | 91 | 92 | 93 | <!ELEMENT log4js:event (log4js:message, log4js:throwable?) > 94 | 95 | <!-- The timestamp format is application dependent. --> 96 | <!ATTLIST log4js:event 97 | logger CDATA #REQUIRED 98 | level CDATA #REQUIRED 99 | timestamp CDATA #REQUIRED 100 | > 101 | 102 | <!ELEMENT log4js:message (#PCDATA)> 103 | 104 | <!ELEMENT log4js:throwable (#PCDATA)> 105 | 106 | <!ELEMENT log4js:locationInfo EMPTY> 107 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/appenders/ajax.js: -------------------------------------------------------------------------------- 1 | describe('appenders/ajax', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it('interface', function() { 6 | var ajaxLogger = Log4js.getLogger('ajax'); 7 | var appender = new Log4js.AjaxAppender(ajaxLogger, '/log4js'); 8 | assert.equal(appender instanceof Log4js.Appender, true); 9 | appender.setLayout(new Log4js.SimpleLayout()); 10 | appender.setLogger(ajaxLogger); 11 | }); 12 | 13 | 14 | it('set threshold', function() { 15 | var ajaxLogger = Log4js.getLogger('ajax'); 16 | 17 | var ajaxAppender = new Log4js.AjaxAppender(ajaxLogger, '/log4js'); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/appenders/console.js: -------------------------------------------------------------------------------- 1 | describe('appenders/ajax', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it("interface", function() { 6 | var logger = Log4js.getLogger('ajax'); 7 | var appender = new Log4js.ConsoleAppender(); 8 | appender.setLayout(new Log4js.SimpleLayout()); 9 | appender.setLogger(logger); 10 | 11 | appender.setAccessKey('d'); 12 | }); 13 | 14 | it("window", function() { 15 | var logger = new Log4js.getLogger('windowTest'); 16 | logger.setLevel(Log4js.Level.ALL); 17 | logger.addAppender(new Log4js.ConsoleAppender()); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/formatters/date.js: -------------------------------------------------------------------------------- 1 | describe('formatters/date', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it("constant", function() { 6 | assert.equal(Log4js.DateFormatter.DEFAULT_DATE_FORMAT, 'yyyy-MM-ddThh:mm:ssO'); 7 | 8 | var dateFormatter = new Log4js.DateFormatter(); 9 | }); 10 | 11 | it("format date year", function() { 12 | var dateFormatter = new Log4js.DateFormatter(); 13 | 14 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 15 | 16 | assert.equal(dateFormatter.formatDate(testDate, 'yyyy'), '2006'); 17 | }); 18 | 19 | it("format date month", function() { 20 | var dateFormatter = new Log4js.DateFormatter(); 21 | 22 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 23 | 24 | assert.equal(dateFormatter.formatDate(testDate, 'MM'), '01'); 25 | }); 26 | 27 | it("format date day", function() { 28 | var dateFormatter = new Log4js.DateFormatter(); 29 | 30 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 31 | 32 | assert.equal(dateFormatter.formatDate(testDate, 'dd'), '02'); 33 | }); 34 | 35 | it("format date hour", function() { 36 | var dateFormatter = new Log4js.DateFormatter(); 37 | 38 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 39 | 40 | assert.equal(dateFormatter.formatDate(testDate, 'hh'), '03'); 41 | }); 42 | 43 | it("format date minute", function() { 44 | var dateFormatter = new Log4js.DateFormatter(); 45 | 46 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 47 | assert.equal(dateFormatter.formatDate(testDate, 'mm'), '04'); 48 | }); 49 | 50 | it("format date seconds", function() { 51 | var dateFormatter = new Log4js.DateFormatter(); 52 | 53 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 54 | 55 | assert.equal(dateFormatter.formatDate(testDate, 'ss'), '06'); 56 | 57 | }); 58 | 59 | it.skip("format date timezone offset", function() { 60 | var dateFormatter = new Log4js.DateFormatter(); 61 | 62 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 63 | 64 | assert.equal(dateFormatter.formatDate(testDate, 'O'), '+0100'); 65 | }); 66 | 67 | it.skip("format date default", function() { 68 | assert.equal(Log4js.DateFormatter.DEFAULT_DATE_FORMAT, 'yyyy-MM-ddThh:mm:ssO'); 69 | 70 | var dateFormatter = new Log4js.DateFormatter(); 71 | 72 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 73 | 74 | assert.equal( 75 | dateFormatter.formatDate(testDate, Log4js.DateFormatter.DEFAULT_DATE_FORMAT), 76 | '2006-01-02T03:04:06+0100' 77 | ); 78 | }); 79 | 80 | it("format date", function() { 81 | assert.equal(Log4js.DateFormatter.DEFAULT_DATE_FORMAT, 'yyyy-MM-ddThh:mm:ssO'); 82 | 83 | var dateFormatter = new Log4js.DateFormatter(); 84 | 85 | var testDate = new Date(2006, 0, 2, 3, 4, 6, 7); 86 | 87 | assert.equal(dateFormatter.formatDate(testDate, 'yyyy-MM-dd hh:mm:ss'), '2006-01-02 03:04:06'); 88 | }); 89 | }); 90 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/layouts/basic.js: -------------------------------------------------------------------------------- 1 | describe('layouts/basic', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it("layout interface", function() { 6 | var logger = Log4js.getLogger('test'); 7 | var layout = new Log4js.BasicLayout(); 8 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 9 | }); 10 | 11 | if("format", function() { 12 | var logger = Log4js.getLogger('test'); 13 | var layout = new Log4js.BasicLayout(); 14 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/layouts/json.js: -------------------------------------------------------------------------------- 1 | describe('layouts/pattern', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it("simple string message format", function() { 6 | var logger = Log4js.getLogger('test'); 7 | var layout = new Log4js.JSONLayout(); 8 | var testEvent = new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'sample-text', 'exception', logger); 9 | var stringOutput = layout.format(testEvent); 10 | var actual = JSON.parse(stringOutput); 11 | assert.property(actual, "LoggingEvent", "Should encapsulate logging events"); 12 | assert.propertyVal(actual.LoggingEvent, "message", "sample-text", "message should match"); 13 | assert.propertyVal(actual.LoggingEvent, "level", "DEBUG", "debug level should be"); 14 | assert.propertyVal(actual.LoggingEvent, "exception", "exception", "exception should be in place"); 15 | }); 16 | 17 | it("object message format", function() { 18 | var logger = Log4js.getLogger('test'); 19 | var layout = new Log4js.JSONLayout(); 20 | var sampleDate = new Date(1511111111111); 21 | var sampleDateISO = sampleDate.toISOString().replace(/\.\d{3}Z/, "Z"); 22 | var obj = { message: "some message", collectedCoins: 120000, when: sampleDate, name: "Zeratul" }; 23 | var testEvent = new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, obj, 'exception', logger); 24 | var stringOutput = layout.format(testEvent); 25 | var actual = JSON.parse(stringOutput); 26 | assert.property(actual, "LoggingEvent", "Should encapsulate logging events"); 27 | assert.propertyVal(actual.LoggingEvent, "message", "some message", "message should match"); 28 | assert.property(actual.LoggingEvent, "collectedCoins_l", "Should contain collectedCoins property of type Long"); 29 | assert.propertyVal(actual.LoggingEvent, "collectedCoins_l", obj.collectedCoins, "Should be propper count of coins"); 30 | assert.property(actual.LoggingEvent, "name_s", "Should contain name property of type String"); 31 | assert.propertyVal(actual.LoggingEvent, "name_s", obj.name, "Should be propper name"); 32 | assert.property(actual.LoggingEvent, "when_dt", "Should contain when property of type date/time"); 33 | assert.propertyVal(actual.LoggingEvent, "when_dt", sampleDateISO, "Should be propper date"); 34 | assert.propertyVal(actual.LoggingEvent, "level", "DEBUG", "debug level should be"); 35 | assert.propertyVal(actual.LoggingEvent, "exception", "exception", "exception should be in place"); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/layouts/pattern.js: -------------------------------------------------------------------------------- 1 | describe('layouts/pattern', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it('layout interface', function() { 6 | var logger = Log4js.getLogger('test'); 7 | var layout = new Log4js.PatternLayout(); 8 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 9 | }); 10 | 11 | it('format', function() { 12 | var logger = Log4js.getLogger('test'); 13 | var layout = new Log4js.PatternLayout(); 14 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/layouts/xml.js: -------------------------------------------------------------------------------- 1 | describe('layouts/pattern', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it("layout interface", function() { 6 | var logger = Log4js.getLogger('test'); 7 | var layout = new Log4js.XMLLayout(); 8 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 9 | }); 10 | 11 | it("format", function() { 12 | var logger = Log4js.getLogger('test'); 13 | var layout = new Log4js.XMLLayout(); 14 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 15 | }); 16 | 17 | it("referer format", function() { 18 | var logger = Log4js.getLogger('test'); 19 | var layout = new Log4js.XMLLayout(); 20 | layout.format(new Log4js.LoggingEvent('categoryName', Log4js.Level.DEBUG, 'message', 'exception', logger)); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /log4js/src/test/js/unit/logger.js: -------------------------------------------------------------------------------- 1 | describe('layouts/basic', function () { 2 | 'use strict'; 3 | var assert = chai.assert; 4 | 5 | it("basics Version String check", function() { 6 | assert.equal(Log4js.version, '2.0.0'); 7 | }); 8 | 9 | it("get default logger", function() { 10 | assert.equal(Log4js.getDefaultLogger().toString(), new Log4js.Logger('[default]').toString()); 11 | assert.equal(Log4js.loggers['[default]'].toString(), Log4js.getDefaultLogger().toString()); 12 | }); 13 | 14 | it("get logger", function() { 15 | assert.isNotNull(Log4js.getLogger('category')); 16 | assert.equal(Log4js.getLogger('category').toString(), new Log4js.Logger('category').toString()); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /log4js/src/test/karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function(config) { 2 | config.set({ 3 | 4 | // base path, that will be used to resolve files and exclude 5 | basePath : '../../', 6 | 7 | frameworks : ['mocha'], 8 | 9 | // list of files / patterns to load in the browser 10 | files : [ 11 | 'node_modules/chai/chai.js', 12 | 'target/files/log4js/js/log4js.min.js', 13 | 'src/test/js/unit/**/*.js', 14 | 'src/test/js/unit/*.js' 15 | // 'test/functional/**/*.js', 16 | // {pattern: 'src/test/**/*.png', watched: false, included: false, served: true} 17 | ], 18 | 19 | // list of files to exclude 20 | //exclude : [], 21 | 22 | // use dolts reporter, as travis terminal does not support escaping sequences 23 | // possible values: 'dots', 'progress', 'junit', 'teamcity' 24 | // CLI --reporters progress 25 | reporters : ['spec'], 26 | 27 | // web server port 28 | // CLI --port 9876 29 | port : 9876, 30 | 31 | // cli runner port 32 | // CLI --runner-port 9100 33 | runnerPort : 9100, 34 | 35 | // enable / disable colors in the output (reporters and logs) 36 | // CLI --colors --no-colors 37 | colors : true, 38 | 39 | // level of logging 40 | // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG 41 | // CLI --log-level debug 42 | logLevel : config.LOG_INFO, 43 | 44 | // enable / disable watching file and executing tests whenever any file changes 45 | // CLI --auto-watch --no-auto-watch 46 | autoWatch : false, 47 | 48 | // Start these browsers, currently available: 49 | // - Chrome 50 | // - ChromeCanary 51 | // - Firefox 52 | // - Opera 53 | // - Safari (only Mac) 54 | // - PhantomJS 55 | // - IE (only Windows) 56 | // CLI --browsers Chrome,Firefox,Safari 57 | browsers : ['Chrome', 'Firefox', 'IE'], 58 | 59 | // If browser does not capture in given timeout [ms], kill it 60 | // CLI --capture-timeout 60000 61 | captureTimeout : 60000, 62 | 63 | // Auto run tests on start (when browsers are captured) and exit 64 | // CLI --single-run --no-single-run 65 | singleRun : true, 66 | 67 | // report which specs are slower than 500ms 68 | // CLI --report-slower-than 500 69 | reportSlowerThan : 5000, 70 | 71 | preprocessors : { 72 | // '**/client/js/*.js': 'coverage' 73 | }, 74 | 75 | plugins : [ 76 | 'karma-chrome-launcher', 77 | 'karma-firefox-launcher', 78 | 'karma-ie-launcher', 79 | 'karma-edge-launcher', 80 | 'karma-mocha', 81 | // 'karma-phantomjs-launcher' 82 | 'karma-spec-reporter' 83 | ] 84 | }); 85 | }; 86 | -------------------------------------------------------------------------------- /log4js/src/test/resources/log4js-event-test.xml: -------------------------------------------------------------------------------- 1 | <log4js:eventSet xmlns:log4js="http://stritti.github.io/log4js//2007/log4js/" 2 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3 | xsi:schemaLocation="http://stritti.github.io/log4js//2007/log4js/ log4js.xsd"> 4 | <log4js:event logger="ajaxTest" level="TRACE" 5 | client="Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1" 6 | referer="http://localhost:8080/log4js-example-0.3/" 7 | timestamp="2006-08-02T17:40:32+02:00"> 8 | <log4js:message><![CDATA[I was traced!]]></log4js:message> 9 | <log4js:throwable> 10 | <log4js:message>Exception</log4js:message> 11 | <log4js:stacktrace> 12 | <log4js:location class="this.is.my.class" 13 | fileName="class.java" lineNumber="43" method="aMethod" /> 14 | <log4js:location class="this.is.another.classx" 15 | fileName="classx.java" lineNumber="57" method="callAMethod" /> 16 | </log4js:stacktrace> 17 | 18 | </log4js:throwable> 19 | </log4js:event> 20 | <log4js:event logger="ajaxTest" level="DEBUG" 21 | client="Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1" 22 | referer="http://localhost:8080/log4js-example/" 23 | timestamp="2006-08-02T17:40:32+02:00"> 24 | <log4js:message><![CDATA[I was debuged!]]></log4js:message> 25 | </log4js:event> 26 | <log4js:event logger="ajaxTest" level="INFO" 27 | client="Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1" 28 | referer="http://stritti.github.io/log4js//log4js/" 29 | timestamp="2006-08-02T17:40:33+02:00"> 30 | <log4js:message><![CDATA[I was informed!]]></log4js:message> 31 | </log4js:event> 32 | </log4js:eventSet> 33 | -------------------------------------------------------------------------------- /log4js/src/test/resources/log4js-response-test.xml: -------------------------------------------------------------------------------- 1 | <log4js:response state="Error" 2 | xmlns:log4js="http://stritti.github.io/log4js//2007/log4js/" 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 | xsi:schemaLocation="http://stritti.github.io/log4js//2007/log4js/ log4js.xsd"> 5 | <log4js:message>All right!</log4js:message> 6 | <log4js:throwable> 7 | <log4js:message>An exception occurred.</log4js:message> 8 | <log4js:description>The long truth...</log4js:description> 9 | <log4js:stacktrace> 10 | <log4js:location class="this.is.my.class" 11 | fileName="class.java" lineNumber="43" method="aMethod" /> 12 | <log4js:location class="this.is.another.classx" 13 | fileName="classx.java" lineNumber="57" method="callAMethod" /> 14 | </log4js:stacktrace> 15 | </log4js:throwable> 16 | </log4js:response> 17 | -------------------------------------------------------------------------------- /log4js/tasks/karma.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 'use strict'; 3 | 4 | var path = require('path'); 5 | var server = require('karma').server; 6 | 7 | grunt.registerMultiTask('karma', 'run karma.', function(target) { 8 | //merge data onto options, with data taking precedence 9 | var options = grunt.util._.merge(this.options(), this.data), 10 | done = this.async(); 11 | 12 | if (options.configFile) { 13 | options.configFile = grunt.template.process(options.configFile); 14 | options.configFile = path.resolve(options.configFile); 15 | } 16 | 17 | done = this.async(); 18 | server.start(options, function(code) { 19 | done(!code); 20 | }); 21 | }); 22 | }; 23 | --------------------------------------------------------------------------------