How to use the log4js.getLogger function in log4js

To help you get started, we’ve selected a few log4js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github acmeair / acmeair-nodejs / acmeairhttp / index.js View on Github external
module.exports = function (settings) {
    var module = {};
    var http = require('http')

    var contextRoot = settings.authContextRoot || "/acmeair-auth-service/rest/api"
	var location = process.env.AUTH_SERVICE;
	
    var hostAndPort = location.split(":");

	var log4js = require('log4js');
	var logger = log4js.getLogger('acmeairhttp');
	logger.setLevel(settings.loggerLevel);
	
    module.createSession = function (userid, callback /* (error, sessionId) */){
		var path = contextRoot+"/authtoken/byuserid/" + userid;
	     	var options = {
			hostname: hostAndPort[0],
		 	port: hostAndPort[1] || 80,
		    	path: path,
		    	method: "POST",
		    	headers: {
		    	      'Content-Type': 'application/json'
		    	}
	     }
	
	     logger.debug('createSession  options:'+JSON.stringify(options));
	     var request = http.request(options, function(response){
github sivy / node-short / app.js View on Github external
sys = require('sys'),
    template = require('./template/template'),
    loader = require('./template/loader'),
    admin = require('./admin');

loader.set_path(settings.template_path);

/*
 * LOGGING SUPPORT
 */
var log4js = require('log4js');
log4js.addAppender(log4js.consoleAppender(), 'app');
log4js.addAppender(log4js.consoleAppender(), 'resolved');
log4js.addAppender(log4js.consoleAppender(), 'defer_queue');

app_log = log4js.getLogger('app');
app_log.setLevel('TRACE');

resolved_log = log4js.getLogger('resolved');
resolved_log.setLevel('TRACE');

defer_log = log4js.getLogger('defer_queue');
defer_log.setLevel('TRACE');

// error handling
function handleError(error, res) {
    app_log.error(error.message);
    app_log.debug(JSON.stringify(error));

    res.contentType('text/plain');
    res.send(error.message);
    res.end();
github facebookarchive / atom-ide-ui / big-dig-samples / command-line-client / cli.js View on Github external
async onDidConnect(
        connection: BigDigClient,
        config: SshConnectionConfiguration,
      ) {
        getLogger().info(`Connected to server at: ${connection.getAddress()}`);
        // TODO(mbolin): Do this in a better way that does not interleave
        // with logging output. Maybe a simpler send/response would be a better
        // first sample and there could be a more complex example that uses more
        // of the Observable API.
        connection.onMessage('raw-data').subscribe(x => getLogger().info(x));

        // Once the connection is established, the common pattern is to pass
        // the WebSocketTransport to the business logic that needs to
        // communicate with the server.
        const client = new QuestionClient(connection, resolve);
        client.run();
      },
github facebookarchive / flow-language-server / packages / flow-language-server / src / pkg / nuclide-flow-rpc / lib / FlowIDEConnectionWatcher.js View on Github external
processStream.connect();

      // eslint-disable-next-line no-await-in-loop
      proc = await processPromise;
      // dispose() could have been called while we were waiting for the above promise to resolve.
      if (this._isDisposed) {
        if (proc != null) {
          proc.kill();
        }
        return;
      }
      const attemptEndTime = this._getTimeMS();
      if (proc != null || attemptEndTime > endTimeMS) {
        break;
      } else {
        getLogger('nuclide-flow-rpc').info(
          'Failed to start Flow IDE connection... retrying',
        );
        const attemptWallTime = attemptEndTime - attemptStartTime;
        const additionalWaitTime =
          IDE_CONNECTION_MIN_INTERVAL_MS - attemptWallTime;
        if (additionalWaitTime > 0) {
          getLogger('nuclide-flow-rpc').info(
            `Waiting an additional ${additionalWaitTime} ms before retrying`,
          );
          // eslint-disable-next-line no-await-in-loop
          await this._sleep(additionalWaitTime);
        }
      }
    }
    if (proc == null) {
      getLogger('nuclide-flow-rpc').error(
github usemodj / angularjs-express-mysql / backend / controllers / option_values.js View on Github external
var async = require('async');
var log = require('log4js').getLogger('option_types');

module.exports = {
    updatePosition: function(req, res, next){
        log.debug(req.body);
        var entry = req.body.entry;
        var ids = [];
        if(entry) ids = entry.split(',');

        if(ids.length === 0) return next();
        var OptionValue = req.models.option_values;
        var i = 1;
        async.eachSeries(ids, function(id, callback){
            OptionValue.get(id, function(err, optionValue){
                //console.log('>>i:'+i);
                //optionValue.position = i++;
                optionValue.save({id:optionValue.id, position: i++}, function(err){
github ralfbecher / q-risotto / sources / server.js View on Github external
'use strict';

const Hapi = require('hapi');
const Inert = require('inert');
const path = require('path')
const fs = require('fs');
const routes = require('./routes');
const config = require('./src/config/config')
const log4js = require('log4js');
const logger = log4js.getLogger();

logger.info("q-risotto started");

const server = new Hapi.Server();
const port = process.env.PORT || config.port;

process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

server.register(Inert, (err) => {
    if (err) {
        throw err;
    }
});

if (config.certificatesPath) {
    server.connection({
github blockstack / blockstack-browser / app / js / welcome / WelcomeModal.js View on Github external
import { decrypt, isBackupPhraseValid } from '@utils'

import { AccountActions } from '../account/store/account'
import { IdentityActions } from '../profiles/store/identity'
import { SettingsActions } from '../account/store/settings'
import { redirectToConnectToGaiaHub } from '../account/utils/blockstack-inc'

import { PairBrowserView, LandingView,
  NewInternetView, RestoreView, DataControlView, EnterPasswordView,
  CreateIdentityView, WriteDownKeyView, ConfirmIdentityKeyView,
  EnterEmailView,
  ConnectStorageView } from './components'

import log4js from 'log4js'

const logger = log4js.getLogger('welcome/WelcomeModal.js')

const START_PAGE_VIEW = 0
const WRITE_DOWN_IDENTITY_PAGE_VIEW = 6
const EMAIL_VIEW = 3
const STORAGE_PAGE_VIEW = 8

function mapStateToProps(state) {
  return {
    api: state.settings.api,
    promptedForEmail: state.account.promptedForEmail,
    encryptedBackupPhrase: state.account.encryptedBackupPhrase,
    identityAddresses: state.account.identityAccount.addresses,
    connectedStorageAtLeastOnce: state.account.connectedStorageAtLeastOnce,
    email: state.account.email
  }
}
github slonoed / jsref / src / fixes / implicit-return-to-explicit.js View on Github external
constructor(opts: FixerOptions) {
    this.type = 'implicit_return_to_explicit'
    this.ds = opts.documentStorage
    this.ast = opts.astHelper
    this.logger = getLogger(this.type)
  }
github ibm-cloud-security / appid-serversdk-nodejs / lib / appid-sdk.js View on Github external
Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

const Log4js = require("log4js");
const APIStrategy = require("./strategies/api-strategy");
const WebAppStrategy = require("./strategies/webapp-strategy");
const UserProfileManager = require("./user-profile-manager/user-profile-manager");
const SelfServiceManager = require("./self-service/self-service-manager");
const UnauthorizedException = require("./user-profile-manager/unauthorized-exception");
const TokenManager = require("./token-manager/token-manager");

const logger = Log4js.getLogger("appid-sdk");
logger.info("Initialized");

module.exports = {
	APIStrategy: APIStrategy,
	WebAppStrategy: WebAppStrategy,
	SelfServiceManager: SelfServiceManager,
	UserProfileManager: UserProfileManager,
	UnauthorizedException: UnauthorizedException,
	TokenManager: TokenManager
};
github facebookarchive / atom-ide-ui / modules / nuclide-debugger-vsps / spec / vscode-ocaml-spec.js View on Github external
* of patent rights can be found in the PATENTS file in the same directory.
 *
 * @flow
 * @format
 */

import * as DebugProtocol from 'vscode-debugprotocol';
import * as fs from 'fs';
import {getLogger} from 'log4js';
import nuclideUri from 'nuclide-commons/nuclideUri';
import {runCommand} from 'nuclide-commons/process';
import VsDebugSession from 'nuclide-debugger-common/VsDebugSession';
import {Logger} from 'vscode-debugadapter';
import {THREAD_ID} from '../vscode-ocaml/OCamlDebugger';

const logger = getLogger('vscode-ocaml-spec');
const adapterInfo = {
  command: 'node',
  args: [
    nuclideUri.join(
      __dirname,
      '..',
      'vscode-ocaml',
      'vscode-debugger-entry.js',
    ),
  ],
};
const OCAML_FIXTURES = nuclideUri.join(__dirname, 'fixtures', 'ocaml');

function makeSource(name: string): DebugProtocol.Source {
  return {
    name,