在没有深入讨论EntLib日志块的优点或其他内容的情况下,有什么方法可以在运行时更改它的配置?
例如,我将块配置为将常规事件记录到平面文件,将重要事件记录到事件日志.
是否有任何方法可以更改它以将常规事件记录到控制台等,而无需重新启动我的应用程序?
澄清:我正在编写一个长期运行的服务器应用程序.我希望能够临时增加各种日志记录组的详细程度/输出以进行诊断/故障排除,而无需重新启动应用程序.重启不是一种选择,因为它意味着生产中的"站点停机".
我有一个带有 Settings.settings 文件的 VS2010 解决方案。用户设置保存到本地设置文件夹,这是一个问题,因为这些设置不会漫游。
目前,设置文件会自动保存到:
Dim config_initial As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal)
Console.WriteLine("Local user config path: {0}", config_initial.FilePath)
Run Code Online (Sandbox Code Playgroud)
( C:\Documents and Settings\%username%\Local Settings\Application Data\%company%\%application%.exe_Url_%hash%\%version%\user.config)
有没有办法将此文件保存到由以下标识的文件路径:
Dim config_new As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoaming)
Console.WriteLine("User config path: {0}", config_new.FilePath)
Run Code Online (Sandbox Code Playgroud)
( C:\Documents and Settings\%username%\Application Data\%company%\%application%.exe_Url_%hash%\%version%\user.config)
我只是My.Settings.Save()在应用程序当前终止时使用或自动保存。
我想知道是否有可能在一个动作中从view.yml获取样式表的名称,理想情况下使用如下简单的东西:
sfConfig::get('......');
Run Code Online (Sandbox Code Playgroud)
我想访问view.yml中的现有声明,而不是硬编码或复制它,如app.yml.
谢谢.
我想在PHP中添加一个函数,这样我就可以在我的服务器上运行的任何脚本中使用它.是否可以注册一个函数,如果它是PHP本机的?PHP是否有某种配置文件,我可以注册新的全局/本机函数?
没有意图在生产中使用它,我只是对如何实现这一点感到好奇.
我在一个 URL 中有一个 .mobileconfig 文件。我正在从 xcode 发送 Http 帖子(单击按钮时),http 帖子包含 .mobileconfig url。我可以在单击按钮时下载该文件吗?
在ZF2应用程序中,我有一些共同点:1.需要根据环境的不同而不同; 2.具体针对具体模块.我curently使用它像这里描述:
global.php&local.php
return array(
...
'modules' => array(
'Cache' => array(
'ttl' => 1, // 1 second
)
)
...
);
Run Code Online (Sandbox Code Playgroud)
模块类
Module {
...
public function getServiceConfig() {
try {
return array (
'factories' => array(
'Zend\Cache\Adapter\MemcachedOptions' => function ($serviceManager) {
return new MemcachedOptions(array(
'ttl' => $this->getConfig()['modules']['Cache']['ttl'],
...
));
},
...
)
);
}
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,但我相信,模块特定设置应该通过模块中的一个中心位置访问 - 类的getConfig()方法Module.像这样:
class Module {
public function getConfig() {
$moduleConfig = include __DIR__ …Run Code Online (Sandbox Code Playgroud) 我想octave-workspace从我的主目录更改文件,只需将其重命名为.octave_workspace.如何使用此新名称设置octave识别工作区文件(或创建新文件)?
谢谢.
我将数据库连接的用户名和密码存储在
/config/connections.js
Run Code Online (Sandbox Code Playgroud)
我将在哪里存储更通用的内容(例如AWS凭证)?
我想象将下面的对象保存在某个文件中。
module.exports.aws = {
key:'my key',
secret: 'my token',
bucket: 'my bucket'
}
Run Code Online (Sandbox Code Playgroud)
然后像这样使用它:
req.file('image')
.upload({
adapter:require('skipper-s3'),
key:aws.key,
secret:aws.secret,
bucket:aws.bucket,
}, function whenDone(err, uploadedFiles) {
}
Run Code Online (Sandbox Code Playgroud) 假设我有一种情况,我只需要在某些生产服务器上应用 Puppet 配置中的两个文件,而不需要触及配置的其余部分。
/opt/aservice/myfile/thekey.conf /opt/myfile/thekey.salt
我们还假设这些是由以下 Puppet 清单控制的:
#
# author: Nathan Basanese (nathan@basanese.com)
# date: 04/17/2048
#
class keyconfig ( $cluster ){
notify {"Deploying key config. files to $fqdn":}
file {'/opt/aservice/key/config/thekey.conf':
ensure => present,
mode => '0644',
owner => 'aservice-serv',
group => 'aservice-serv',
source => "puppet:///modules/keyconfig/$cluster/thekey.conf",
}
file {'/opt/aservice/key/config/thekey.salt':
ensure => present,
mode => '0644',
owner => 'aservice-serv',
group => 'aservice-serv',
source => "puppet:///modules/keyconfig/$cluster/thekey.salt",
}
}
Run Code Online (Sandbox Code Playgroud)
我如何从 Puppet Master 仅将这两个文件应用到给定服务器?
也许,在puppet agent目标服务器上运行的命令中,我可以指定要使用的特定 Puppet 类吗?
我以前使用过该puppet resource …
我有一个要在多台计算机上使用的标准.emacs文件。其中一台机器无法加载我的所有elisp库。
现在,我在wc-mode-0.2.el不存在的机器上收到此错误:
Cannot open load file: wc-mode-0.2.el
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以使.emacs文件此时不会出错?或者通过: