热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

写mongodb日志

Thefollowingstepscreateandrotatealogfile:Startawithverboselogging,withappendingenabled,andwiththefollowinglogfile:mongod-v--logpathvarlogmongodbserver1.log--logappendInaseparateterminal,listthematching

The following steps create and rotate a log file: Start awith verbose logging, with appending enabled, and with the following log file: mongod -v --logpath /var/log/mongodb/server1.log --logappend In a separate terminal, list the matching

The following steps create and rotate a log file:

  • Start a with verbose logging, with appending enabled, and with the following log file:

    mongod -v --logpath /var/log/mongodb/server1.log --logappend

  • In a separate terminal, list the matching files:

    ls /var/log/mongodb/server1.log*

    For results, you get:

  • Rotate the log file using one of the following methods.

  • From the shell, issue the command from the admin database:

    This is the only available method to rotate log files on Windows systems.

  • From the UNIX shell, rotate logs for a single process by issuing the following command:

  • From the UNIX shell, rotate logs for all processes on a machine by issuing the following command:

  • List the matching files again:

    ls /var/log/mongodb/server1.log*

    For results you get something similar to the following. The timestamps will be different.

    server1.log server1.log.2011-11-24T23-30-00

    The example results indicate a log rotation performed at exactly 11:30 pm on November 24th, 2011 UTC, which is the local time offset by the local time zone. The original log file is the one with the timestamp. The new log is server1.log file.

    If you issue a second command an hour later, then an additional file would appear when listing matching files, as in the following example:

    server1.log server1.log.2011-11-24T23-30-00 server1.log.2011-11-25T00-30-00

    This operation does not modify the server1.log.2011-11-24T23-30-00 file created earlier, while server1.log.2011-11-25T00-30-00 is the previous server1.log file, renamed. server1.log is a new, empty file that receives all new log output.

  • ,免备案空间,香港服务器,美国空间
    推荐阅读
    • Allegro总结:1.防焊层(SolderMask):又称绿油层,PCB非布线层,用于制成丝网印板,将不需要焊接的地方涂上防焊剂.在防焊层上预留的焊盘大小要比实际的焊盘大一些,其差值一般 ... [详细]
    • Linux如何安装Mongodb的详细步骤和注意事项
      本文介绍了Linux如何安装Mongodb的详细步骤和注意事项,同时介绍了Mongodb的特点和优势。Mongodb是一个开源的数据库,适用于各种规模的企业和各类应用程序。它具有灵活的数据模式和高性能的数据读写操作,能够提高企业的敏捷性和可扩展性。文章还提供了Mongodb的下载安装包地址。 ... [详细]
    • Abp+MongoDb改造默认的审计日志存储位置
      一、背景在实际项目的开发当中,使用AbpZero自带的审计日志功能写入效率比较低。其次审计日志数据量中后期十分庞大,不适合与业务数据存放在一起。所以我们可以重新实现A ... [详细]
    • 搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的详细步骤
      本文详细介绍了搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的步骤,包括环境说明、相关软件下载的地址以及所需的插件下载地址。 ... [详细]
    • 本文是一位90后程序员分享的职业发展经验,从年薪3w到30w的薪资增长过程。文章回顾了自己的青春时光,包括与朋友一起玩DOTA的回忆,并附上了一段纪念DOTA青春的视频链接。作者还提到了一些与程序员相关的名词和团队,如Pis、蛛丝马迹、B神、LGD、EHOME等。通过分享自己的经验,作者希望能够给其他程序员提供一些职业发展的思路和启示。 ... [详细]
    • 本文讨论了在Windows 8上安装gvim中插件时出现的错误加载问题。作者将EasyMotion插件放在了正确的位置,但加载时却出现了错误。作者提供了下载链接和之前放置插件的位置,并列出了出现的错误信息。 ... [详细]
    • 本文介绍了在Hibernate配置lazy=false时无法加载数据的问题,通过采用OpenSessionInView模式和修改数据库服务器版本解决了该问题。详细描述了问题的出现和解决过程,包括运行环境和数据库的配置信息。 ... [详细]
    • [译]技术公司十年经验的职场生涯回顾
      本文是一位在技术公司工作十年的职场人士对自己职业生涯的总结回顾。她的职业规划与众不同,令人深思又有趣。其中涉及到的内容有机器学习、创新创业以及引用了女性主义者在TED演讲中的部分讲义。文章表达了对职业生涯的愿望和希望,认为人类有能力不断改善自己。 ... [详细]
    • 本文介绍了在Win10上安装WinPythonHadoop的详细步骤,包括安装Python环境、安装JDK8、安装pyspark、安装Hadoop和Spark、设置环境变量、下载winutils.exe等。同时提醒注意Hadoop版本与pyspark版本的一致性,并建议重启电脑以确保安装成功。 ... [详细]
    • 本文介绍了Hyperledger Fabric外部链码构建与运行的相关知识,包括在Hyperledger Fabric 2.0版本之前链码构建和运行的困难性,外部构建模式的实现原理以及外部构建和运行API的使用方法。通过本文的介绍,读者可以了解到如何利用外部构建和运行的方式来实现链码的构建和运行,并且不再受限于特定的语言和部署环境。 ... [详细]
    • 本文介绍了在Windows系统下安装Mongodb的详细步骤和注意事项。包括下载Mongodb官方文档、选择64位安装包、配置环境变量、命令行启动Mongodb等。通过本文的指导,用户可以轻松完成Mongodb的安装并进行相关操作。 ... [详细]
    • MongoDB用户验证auth的权限设置及角色说明
      本文介绍了MongoDB用户验证auth的权限设置,包括readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase、cluster相关的权限以及root权限等角色的说明和使用方法。 ... [详细]
    • centos php部署到nginx 404_NodeJS项目部署到阿里云ECS服务器全程详解
      本文转载自:http:www.kovli.com20170919ecs-deploy作者:Kovli本文详细介绍如何部署NodeJS项目到阿里云ECS上, ... [详细]
    • step1.为mongodb添加admin管理员root@12.154.29.163:~#mongoMongoDBshellversionv3.4.2connectingto:mo ... [详细]
    • 一、前言在数据库中,慢查询日志通常是用来进行优化数据库,MySQL中存在慢查询,Mongodb中也是如此。在Mongo中的慢查询属于Mon ... [详细]
    author-avatar
    书友53537817
    这个家伙很懒,什么也没留下!
    PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有